Reputation: 9
I have a MySQL table in which I have two columns Fromdate
and Todate
. When ever I execute the stored procedure in MySQL, I want to update the fromdate
and todate
in the above table as next date.
For example
@Fromdate
is 09/04/2016 15:00:00 @Todate
is 09/04/2016 23:59:59It should be updated to:
@Fromdate
= 09/05/2016 00:00:00@Todate
= 09/05/2016 23:59:59Upvotes: 0
Views: 54
Reputation: 31417
Try this
Update yourtable set fromdate=DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00'),todate=DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59') where <<condition>>
Upvotes: 0
Reputation: 5656
TRY THIS: and you can do it with your own selected date as well
UPDATE test_table
SET
from_date = DATE_FORMAT(NOW(),"%Y-%m-%d 00:00:00"),
to_date = DATE_FORMAT(NOW(),"%Y-%m-%d 23:59:59")
and you add rest of conditions whatever you want to.
Upvotes: 1