views:

27

answers:

1

How can I covert this PHP date string:

Thu 19th Aug 2010 @ 7:52PM

to this:

1282247549

Which is done by:

gmdate("D jS M Y @ g:iA", $row['project_deadline'])

The timestamp is from the database with the stored time() function

+3  A: 

You can parse that string into a UNIX timestamp with the strtotime function:

$str = 'Thu 19th Aug 2010 @ 7:52PM';
$str = str_replace('@', '', $str);

$timestamp = strtotime($str);
Jacob Relkin
You need to remove the '@' from $str, for this to work.
Rocket
Excellent, thanks. :)
YouBook
I'll tick it as the accepted answer in 7 minutes...
YouBook
Uh, that was 41 minutes ago ;)
Jacob Relkin
3 hours :O Sorry, was afk ;)
YouBook