Results 1 to 5 of 5
  1. #1
    Mike Mike's Avatar
    Join Date
    Dec 2004
    Location
    3743'24.463"S, 17608'37.057"E
    Posts
    1,316

    Default PHP/mySQL timezone issues

    Hi all,

    My web server is based in the US somewhere. I've got info being inserted into mysql on the webserver, with a timestamp auto-updating. However when I display this info on my web page it shows it as being 2am instead of 8pm.

    Can I:


    1. somehow tell mySQL to add 18 hours when auto-updating the timestamp?
    2. Tell PHP to treat the value coming from the timestamp field as date/time and add 18 hours (therefore often the next day)?

    I don't appear to have access to the configuration to set my timezone. I am going to contact the webhost support to see if I have access to change this, but I'm not holding my breath...

    Anyone have any suggestions?

    Cheers,
    Mike.
    what are you doing looking in here?

  2. #2
    Mike Mike's Avatar
    Join Date
    Dec 2004
    Location
    3743'24.463"S, 17608'37.057"E
    Posts
    1,316

    Default Re: PHP/mySQL timezone issues

    P.S. mysql appears to be storing it as 'YYYY-MM-DD hh:mm:ss', whether that makes any difference (am I able to change that?)

    Mike.
    what are you doing looking in here?

  3. #3
    Gone Erayd's Avatar
    Join Date
    Dec 2004
    Location
    Wellington, NZ
    Posts
    5,755

    Default Re: PHP/mySQL timezone issues

    Use one of the many timezone-setting functions (e.g. date_default_timezone_set()), or the date.timezone ini setting.
    If you are interested in reading fanfiction on a mobile device or ebook reader, please visit flagfic.com.

  4. #4
    Mike Mike's Avatar
    Join Date
    Dec 2004
    Location
    3743'24.463"S, 17608'37.057"E
    Posts
    1,316

    Default Re: PHP/mySQL timezone issues

    Thanks Erayd, that pointed me in the right direction. I needed to convert the timestamp to unix-time or something first for it to work, and then everything has worked from there.

    Cheers,
    Mike.
    what are you doing looking in here?

  5. #5
    Gone Erayd's Avatar
    Join Date
    Dec 2004
    Location
    Wellington, NZ
    Posts
    5,755

    Default Re: PHP/mySQL timezone issues

    If you are interested in reading fanfiction on a mobile device or ebook reader, please visit flagfic.com.

Similar Threads

  1. MySQL Please Help!
    By diggakid in forum PressF1
    Replies: 3
    Last Post: 06-01-2010, 09:27 PM
  2. mysql help
    By WarNox in forum PressF1
    Replies: 5
    Last Post: 17-08-2009, 09:52 PM
  3. mysql database issues
    By Mike in forum PressF1
    Replies: 4
    Last Post: 05-12-2007, 08:48 AM
  4. Timezone website
    By Greg in forum PC World Chat
    Replies: 10
    Last Post: 11-01-2007, 10:50 PM
  5. Coming soon to a timezone near you
    By Graham L in forum PC World Chat
    Replies: 4
    Last Post: 11-04-2005, 09:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •