time zone change

Home Forums Scripts GirlsWhoGeek Scripts time zone change


This topic contains 1 reply, has 2 voices, and was last updated by  amphigory 6 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #13928


    I’m on EST…is there a way to change the way the time posts when I post an entry?



    If you want to post the date in your timezone directly into a database, it depends on your version of PHP.

    For PHP 5: simply use date_default_timezone_set('Australia/Sydney'). When you format a date, it’ll use Sydney time (or whatever time you wish, see PHP’s list of timezones).

    For PHP 4: use putenv('TZ=Australia/Sydney') to get the same effect as above, or use gmdate and determine the offset from UTC for your timezone.

    However, I suggest saving times in the database as UTC time, then displaying them using an offset. That way, it’s much easier to display times for people in other timezones (if you were to offer a way for visitors to choose their own).

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.