本文介绍了如何在SQL中获取DateTime格式的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $> $>>>>>>>>>>>>>>>>>>>>>>>> AttDate == 2011-02-09 13:09:00 2011-02-09 14:10:00 我想要输出: AttDate时间 == 2011-02-09 13:09:00 13:09 2011-02-09 14:10:00 14:10 解决方案 SQL Server 2008: select cast(AttDate as time)[time] from yourtable 早期版本: select convert(char(5),AttDate,108)[time] from yourtable I want to get only Time from DateTime column using SQL query using SQL Server 2005 and 2008Default output:AttDate ==2011-02-09 13:09:00 2011-02-09 14:10:00 I'd like this output:AttDate Time ==2011-02-09 13:09:00 13:092011-02-09 14:10:00 14:10 解决方案 SQL Server 2008:select cast(AttDate as time) [time]from yourtableEarlier versions:select convert(char(5), AttDate, 108) [time]from yourtable 这篇关于如何在SQL中获取DateTime格式的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 12:18