| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 108292 | 2010-03-22 07:10:00 | PHP/mySQL timezone issues | Mike (15) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 869194 | 2010-03-22 07:10:00 | 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: somehow tell mySQL to add 18 hours when auto-updating the timestamp? 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. |
Mike (15) | ||
| 869195 | 2010-03-22 07:12:00 | 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. |
Mike (15) | ||
| 869196 | 2010-03-22 07:39:00 | Use one of the many timezone-setting functions (e.g. date_default_timezone_set() (nz.php.net)), or the date.timezone (nz.php.net) ini setting. | Erayd (23) | ||
| 869197 | 2010-03-22 18:40:00 | 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. |
Mike (15) | ||
| 869198 | 2010-03-22 19:24:00 | :D | Erayd (23) | ||
| 1 | |||||