Representing Jun, 2009 in php strtotime().

tiffix

Student

Posts: 65

Loc: kenya

3+ Months Ago

hello,is there a consistent way of representing the following string for example Jun, 2009 in php to a consistent timestamp so that the resulting timestamp can be consistent even days to come or even earlier days? using strtotime() or any other means in php. thanks...

joebert

Fart Bubbles

Posts: 13506

Loc: Florida

3+ Months Ago

Read http://www.php.net/strtotime

Which will lead you to http://www.php.net/date_default_timezone_get

Which will introduce you to working with timezones in PHP and lead you to http://www.php.net/date_default_timezone_set

Which will explain how to set the timezone being used for date/time functions

Which will make what I'm about to say easier to understand.

Set the timezone to GMT/UTC before parsing the date to get a consistent time stamp.

If that doesn't help, I have no idea whatsoever what you mean when you say consistent.

tiffix

Student

Posts: 65

Loc: kenya

3+ Months Ago

consisten i mean, the resulting int values i get, keep changing day by day and i don't need it to change since it's the same string am passing to the function. otherwise, let me have a look at the links you've given and i'll keep you posted thanks..

tiffix

Student

Posts: 65

Loc: kenya

3+ Months Ago

am afraid that didn't help me, though i learnt alot. i have this kinds of strings for example from mysql "May, 2009". now if even after setting my timezone to "Africa/Nairobi" before using strtotime() i keep getting different results if i adjust my local windows time... any suggestions?