Jump to content

Recommended Posts

The date and time in the database should always be the same timezone (your servers). You just display it based on what user sets.

 

Save with each user the ability to identify their timezone, or +/- hours from your servers timezone.

 

Then you calculate the date and time and display it.

 

Please search these forums and google the web because this has been discussed so many times.

 

http://www.google.com/search?hl=en&q=timezones+%2Bphp

 

http://jokke.dk/2007/07/timezones_in_mysql_and_php

 

http://www.expertsrt.com/tutorials/Matt/PHPTimeZone.html

Link to comment
https://forums.phpfreaks.com/topic/86813-solved-time-zones/#findComment-443692
Share on other sites

You could store everything using unix time...

 

Too many people on here think that it's best to store in a MySQL table a unix based timestamp. I disagree.

 

Use MySQL DATETIME data type instead. It allows you to use a lot of MySQL date and time functions:

 

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add

 

And if you still need a unix timestamp you can still get one out of DATETIME column simply by using UNIX_TIMESTAMP() MySQL function.

 

Link to comment
https://forums.phpfreaks.com/topic/86813-solved-time-zones/#findComment-443971
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.