Page 1 of 1

convert time to unix timestamp

Posted: Mon Nov 26, 2007 10:48 pm
by psychotomus
how can i convert a date say "January 1 2008 1:45am" to a unix timestamp?

Posted: Mon Nov 26, 2007 11:01 pm
by John Cartwright
strtotime() is your friend.

Posted: Mon Nov 26, 2007 11:09 pm
by psychotomus
your my friend

Posted: Wed Nov 28, 2007 11:10 am
by psychotomus
what format does the date have to be in? I looked over http://php.net/strtotime and it doesnt give much detail on that. I also need to include time and date.

Posted: Wed Nov 28, 2007 11:16 am
by feyd
strtotime() will attempt to translate whatever you give it into a unix timestamp.

Posted: Wed Nov 28, 2007 11:18 am
by John Cartwright

Code: Select all

echo strtotime('January 1 2008 1:45am');
translated fine for me