如何删除日期中的时间部分(日期时间格式) [英] how to remove time portion in the date (in datetime format)

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

问题描述

我已将数据从Ms Access迁移到SQL Server 2008,其中字段(ApplicationDate)之一为日期时间数据类型.在SQL Server 2008中,我希望它仅处于日期数据类型.问题是,我想从日期中删除时间部分,以便在此之后可以转换数据类型.我怎样才能做到这一点?
这是即时通讯要使用的转换功能:

I have migrated data from Ms Access to SQL Server 2008 where one of the field (ApplicationDate) is in datetime data type. in SQL Server 2008, i want it to be in date datatype only. The problem is, i want to remove the time part from date so after that i can convert the datatype. How can I do that?
this is the convert function that im going to use:

CONVERT(varchar(20), Getdate(), 105)



我期待的结果是:
来自



The result that i look forward is:
from

2011-05-08 00:00:00.000

变为08-05-2011(dd:mm:yyyy)

becomes 08-05-2011(dd:mm:yyyy)

推荐答案

您在这里

如何格式化datetime& SQL Server 2005中的日期 [ ^ ]
Here you go

How to format datetime & date in Sql Server 2005[^]



试试这个

Hi
try this

select CONVERT (char(10),getdate(),101)




谢谢.




Thanks.


好..谢谢大家..我成功了! :)
Ok..thanks everybody.. i have succeed! :)


这篇关于如何删除日期中的时间部分(日期时间格式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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