Jump to content

Change timezone of the database


resparkman1

Recommended Posts

Hello, I have this prepared statement on my code:

$insert = "INSERT INTO user (user_id, name, date_in, time_in) VALUES (?, ?, CURRENT_DATE, CURRENT_TIME)";

I tested on xampp (localhost) and the value that is inserted on time_in column every time i run this prepared statement is the same as my local time, however I notice when I tried it here on heliohost and check my database, the inserted values for time_in column is different from my time. My question is how can I change the timezone of the database so that the time that would be inserted on time_in column is similar to my local time?

Link to comment
Share on other sites

Server uses UTC for all time-related functions. You can try using the " SET timezone='timezone' " command before running the query (see the documentation for a list of time zones), but I'm not sure if it'll work or not.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...