How to convert GMT time to user-set Timezone (3 posts)

  1. mattifesto
    Posted 5 years ago #

    I am having a heck of a time doing something that I feel should be so simple in a plugin.

    I have a date/time in GMT and I want to convert it to a date/time in the timezone the blog owner has selected in settings. But I can't find anything to do it.

    I would expect date_i18n to do it, but it doesn't.

    I'm using wordpress 2.9.1 and when I call date_default_timezone_get() it returns 'UTC' even though I have my timezone in settings as 'America/Los_Angeles'.

    My current solution is going to be to create a function to do this:

    $timezone = date_default_timezone_get();
    // do date conversion

    I have searched and read and looked at bugs and applied fixes to my local wordpress code and really done my due diligence here, but if through all that I have missed the obvious, please let me know the right thing to do.


  2. vtxyzzy
    Posted 5 years ago #

    Sorry, thought I had a tip, but it was a mistake.

  3. mattifesto
    Posted 5 years ago #

    It also seems like mysql2date is the function a could expose this functionality, but using the $translate parameter has no effect.

Topic Closed

This topic has been closed to new replies.

About this Topic