我怎么能转换成蜱日期格式? [英] How can I convert ticks to a date format?
本文介绍了我怎么能转换成蜱日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个刻度值转换为日期是这样的:
转换(日期时间,(MachineGroups.TimeAdded - 599266080000000000)/ 8640亿);
使用此我得到:
2009年9月27日下午十时50分27秒
不过,我只想以这种格式的日期:
2009年10月1日
我的样品蜱值为
633896886277130000
什么是做到这一点的最好方法是什么?
解决方案
DATENAME(月,(MachineGroups.TimeAdded-599266080000000000)/ 8640亿)+
空间(1)+
DATENAME(D,(MachineGroups.TimeAdded-599266080000000000)/ 8640亿)+
','+
DATENAME(年,(MachineGroups.TimeAdded-599266080000000000)/ 8640亿);
I am converting a ticks value to a date like this:
Convert(datetime, (MachineGroups.TimeAdded - 599266080000000000)/864000000000);
Using this i get:
9/27/2009 10:50:27 PM
But I want just the date in this format:
October 1, 2009
My sample ticks value is
633896886277130000
What is the best way to do this?
解决方案
datename(month,(MachineGroups.TimeAdded-599266080000000000)/864000000000) +
space(1) +
datename(d,(MachineGroups.TimeAdded-599266080000000000)/864000000000) +
', ' +
datename(year,(MachineGroups.TimeAdded-599266080000000000)/864000000000);
这篇关于我怎么能转换成蜱日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文