Reputation: 1
Table name: tasklist
|start_time |end_time |task_duration |
__________________________ __________________________ _______________
|2001-01-01 17:24:50.000000|2014-02-04 10:04:10.000000|00:14:53.000000|
|2013-08-31 10:53:09.000000|2013-09-19 11:16:54.000000|00:21:19.000000|
|2013-08-31 18:30:28.000000|2013-10-07 18:43:55.000000|00:13:17.000000|
I have to change date part of start_time to end_time columns retaining the time values as I need it for task_duration column. I used this query to get this
SELECT * FROM `tasklist` WHERE (DATEDIFF(`end_time`,`start_time`)> 1)
Upvotes: 0
Views: 174
Reputation: 2633
You can find the complete reference here. For example, lets say that you want to add 30 days to the current starttime data. You can achieve the same using the following syntax:
UPDATE tasklist SET starttime = DATE_ADD(starttime, INTERVAL 30 DAY);
Hope this helps!
The link provided at the top of this answer contains plenty examples which can help you understand the operations.
Upvotes: 0
Reputation: 5444
UPDATE YourTable
SET YourColumn = DATEADD(MONTH,1,YourColumn)
WHERE YourColumn = '20120410 08:03:00'
Upvotes: 2