bspacer1 bspacer2
webmail hosting forum clients about

Computer Co-op, CornerNET Internet Gateway, and PJR Solutions is owned by PJR Sales & Service. Quality products and online services since 1991. We can be your
Complete Computer Connection

Hosting @ $5.95

Domains @ $16.98
Home PagePortal HomeClient AreaAnnouncementsKnowledgebaseSupport TicketsDownloadsRegister

Knowledgebase
You are here: Portal Home > Knowledgebase > cPanel Related Issues > MySQL management issues > How to change the MySQL timezone

How to change the MySQL timezone

When you develop your website, you may have to compare a certain date/time with the current date/time on the server.

The timezone on CornerNET's servers is CST. This is a global setting which cannot be changed.

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 2 hours to the result, you can use the following syntax:

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

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

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

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



Was this answer helpful?

Add to Favourites
Print this Article

Also Read
How can I import a large database to my account? PhpMyAdmin times out. (Views: 11279)
I get an error 'ACCESS DENIED CREATE DATABASE db_name' when I try to import a database (Views: 10054)
I get syntax error when trying to run a MySQL query. (Views: 1060)
I don't have enough privileges for creating/dropping databases in PhpMyAdmin (Views: 2706)
I have problems accessing my MySQL database remotely (Views: 5298)

Powered by WHMCompleteSolution


Copyright © 1994-2021 PJR Sales and Service All Rights Reserved