更新日期而不更改时间 [英] Date updation without changing time
本文介绍了更新日期而不更改时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我更新日期.我只需要更新月份而不更改时间
例如:2002-09-11 13:37:14.000
Hi,
Anyone can help me to update date. I need to update the month only without changing the time
eg: 2002-09-11 13:37:14.000
推荐答案
SELECT DATE_ADD(''2008-12-15'',INTERVAL 1 MONTH)
输出:
2009-01-15
SELECT DATE_ADD(''2008-12-15'', INTERVAL 1 MONTH)
Output:
2009-01-15
DateTime dt = DateTime.Now.AddMonths(1);
实际阅读文档时很容易. http://msdn.microsoft.com/en-us/library/system.datetime.aspx [^ ]
Easy when you actually read the documentation. http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^]
如何更新月份?也就是说,向DateTime添加预定义的月份数,将DateTime的Month元素更改为在其他地方定义的其他值,等等?
How do you need to update the month? i.e., add a predefined number of months to the DateTime, change the Month element of the DateTime to a different value defined elsewhere etc?
这篇关于更新日期而不更改时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文