java 从 ms access 中选择 dd.mm.yyyy 格式的日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13973144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
select the date from ms access in dd.mm.yyyy format
提问by Adesh singh
I want to select the data from the database using select command but the result is showing in yy.mm.dd format while i want the result in dd mm yy format I am using the following commad
我想使用 select 命令从数据库中选择数据,但结果以 yy.mm.dd 格式显示,而我想要 dd mm yy 格式的结果我使用以下命令
select date from table1 order by date desc;
how can i get the date in dd mm yyyy format please help me
我怎样才能得到 dd mm yyyy 格式的日期,请帮帮我
采纳答案by Damian Leszczyński - Vash
You need to user format function for date.
select format([date], "dd.mm.yyyy") from table1 order by [date] desc;
select format([date], "dd.mm.yyyy") from table1 order by [date] desc;
回答by Patrick Honorez
You should avoid date as a field Name, since it is a reserved word.
您应该避免将日期作为字段名称,因为它是一个保留字。
select Format([date],"dd/mm/yyyy") as Dt from table1 order by [date] desc;
My feeling is that you should conserve the field as a date until the very end, and just render it in the final form/report/whatever. Using Format() will change it to a string and it will not sort or add properly anymore. In Access, for instance, one would leave is as it is and rather modify the Format property of the Control bound to that field. Since you tagged your question with [Java], I can't tell you more...
我的感觉是,您应该将该字段作为日期保存到最后,然后将其呈现在最终表格/报告/任何内容中。使用 Format() 会将其更改为字符串,并且不再正确排序或添加。例如,在 Access 中,人们会保持原样,而是修改绑定到该字段的 Control 的 Format 属性。既然你用 [Java] 标记了你的问题,我不能告诉你更多......