Converting a user submitted date to GMT |
One thing to be wary of is the format of the date string being supplied. strtotime behaves differently depending on whether '-' or '/' is used in the date string, and can potentially cause issues getting the accurate time. I ran into this since I've done a lot of work for a client out of Manchester, UK, but I live in USA. From the PHP manual:
Quote:Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. strtotime does support parsing out the timezone as part of the string, so it might work to ensure the timezone string is part of the string passed to the strtotime() function, but would need testing. For the project that I had problems on, we knew that all users would be UK area so I didn't have to explore quite that deep and ended up using DateTime::createFromFormat() where possible. |
Messages In This Thread |
Converting a user submitted date to GMT - by randy - 07-01-2015, 09:38 PM
RE: Converting a user submitted date to GMT - by mwhitney - 07-02-2015, 08:55 AM
RE: Converting a user submitted date to GMT - by randy - 07-02-2015, 06:22 PM
RE: Converting a user submitted date to GMT - by randy - 07-02-2015, 06:26 PM
RE: Converting a user submitted date to GMT - by mwhitney - 07-06-2015, 09:06 AM
RE: Converting a user submitted date to GMT - by kilishan - 07-06-2015, 09:41 AM
|