如何检查datatable中的varchar格式日期 [英] how to check varchar format date in datatable

查看:87
本文介绍了如何检查datatable中的varchar格式日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查数据表中的varchar格式日期在C#

how to check varchar format date in datatable In C#

推荐答案

不要将日期存储为字符串:它会导致大量问题,从用户输入的格式是什么?通过我如何比较价值? 我的应用程序中显示的是什么格式?



使用DateTime列 - 尽早将用户输入转换为DateTime,并将其转换为一个字符串尽可能晚。在这两者之间,一切都会在没有你担心的情况下运作。
Don't store dates as strings: it causes an enormous number of problems, starting with "which format did the user enter this in?" through "How do I compare values?" to "What format is this displaying in in my application?"

Use a DateTime column - convert the user input to a DateTime as early as possible, and convert it to a string as late as possible. In between, everything will just work without you havign to worry about it.


这篇关于如何检查datatable中的varchar格式日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆