以特定格式保存在Access数据库中的日期 [英] Date Save in Access database in Particular format

查看:154
本文介绍了以特定格式保存在Access数据库中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以yyyy / MM / dd格式在访问数据库中保存日期?

how to save date in access database in "yyyy/MM/dd" format?

推荐答案

快速回答是:不要。

以任何格式保存基于日期的值的唯一方法是将它们转换为字符串,这是一个非常糟糕的主意。将它们存储为日期,并为您的表示层保存格式,以便您可以以特定格式或用户最熟悉的格式显示它们(即在他的系统上设置)



如果您将它们存储为字符串,当您想要与它们进行任何形式的比较时,它会严重限制您可以轻松完成的任务。
The quick answer is: don''t.
The only way to save date based values in any format is to convert them to strings, and that is a very poor idea. Store them as dates, and save formatting for you presentation layer so you can either display them in a particular format, or in the format the user is most comfortable with (i.e. as set on his system)

If you store them as strings, it severely limits what you can do easily with them when you want to do any form of comparison with them.


这篇关于以特定格式保存在Access数据库中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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