如何仅从datetime数据库列中检索日期? [英] How to retrieve date only from datetime database column?...
本文介绍了如何仅从datetime数据库列中检索日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的sql数据库表中有一个datetime列,如何从该列中仅检索日期而不是时间?....
谢谢
Amit
hey everyone,
I have a datetime column in my sql database table,how can i retrieve only date from that column and not time?....
Thanks
Amit
推荐答案
select convert(varchar,OrderDate,104) as OrderDate from tblOrder
它运行正常.
It''s running properly.
一个小小的google取得了长足的发展("t-sql从datetime获取日期")-我发现至少有三种方法可以做到这一点,在google返回的第一个链接上.这是其中之一:
A little google goes a long way ("t-sql get date from datetime") - I found at least three ways to do it, and that was at the first link returned by google. Here''s one of them:
SELECT CONVERT(CHAR(10),GETDATE(),103)
SELECT CONVERT(VARCHAR(10),GETDATE(),111)
希望对您有帮助.
May this help you.
这篇关于如何仅从datetime数据库列中检索日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文