Skip to content
Advertisement

Updating table with datetime 6 hours advance

I wonder if this is possible I have easily done this with jQuery however I need it on a database that I have no control aside from updating it, what I want to accomplish is update it 6 hours advance let’s say time now is 1AM I’d like it to be 7AM

This code works

UPDATE ffcko_invoices_payments SET payment_duedate=NOW() WHERE invoice_id=14

For getting current date and time but I wonder if its possible to make it 6 hour advance.

Advertisement

Answer

This is quite simple in MySQL:

UPDATE ffcko_invoices_payments
    SET payment_duedate = NOW() + interval 6 hour
    WHERE invoice_id = 14;
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement