更新日期而不更改时间
问题描述:
任何人都可以帮助我更新日期.我只需要更新月份而不更改时间
例如: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?