Knowledgebase

Changing DataBase Time Stamps

How to change Database TimeStamps:

4Goodhosting's servers are set on EDT. This cannot be changed as this is for all users.

You can, however, use an easy workaround if you wish to use a different timezone – you can modify the return of the MySQL NOW() function.

Let’s take a look at the most standard query for selecting the current date/time:

SELECT NOW();

If you want to add 5 hours to the result, you can use the following syntax:

SELECT DATE_ADD(NOW(), INTERVAL 5 HOUR);

In a similar way, if you want to subtract 5 hours from the server timezone, you can use this query:

SELECT DATE_SUB(NOW(), INTERVAL 5 HOUR);

Using DATE_SUB and DATE_ADD, you can modify the query result to fit your specific needs.

Was this answer helpful?

 Print this Article