Skip to content
Advertisement

MYSQL add 2 hours to time in Database when echo to PHP

I have tried numerous ways to get this time zone issue resolved. I have a MYSQL database that stores Time in the following format.

2021-01-15 14:34:46

The time is uploaded by a tellematic device so I have no control over the time loaded to the DB

I need to add two ours to the time from the DB and echo it to a PHP Page

I have tried the following:

JavaScript

The time stays the same no change to it not adding the two hours

AND

JavaScript

There is no output at all

dt_tracker is the date and time saved to the database the DATATYPE is DATETIME

I need to add two hours to the output time.

2021-01-15 16:34:46

Resolved with the following Query:

JavaScript

Advertisement

Answer

JavaScript

In my initial Query I was conflicting the Date format with the Time Format

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement