I just got some tweets using their XML feed, and have gotten the date/times like so
Tue Sep 29 22:30:51 +0000 2009
I tried using strtotime()
on this, but it wasn't producing the correct results.
I later on use
echo date($dateTimeFormat, $twitterUnixTime);
I know I could use a regex, but from the looks of it it will be complicated (and will need to use a callback, to convert 'Sep' to a numeral. From what I understand, strtotime()
can easily do MySQL dates (2009-09-30 13:00:00) and some others (generally from RSS feeds).
What can I do here to get this date/time as an Unix Epoch time?
UPDATE
Here is my code
$dateTime = $status->created_at; // Tue Sep 29 22:30:51 +0000 2009
$date = strtotime($dateTime);
$dateTimeFormat = 'j/n/y g:ia';
echo date($dateTimeFormat, $date); // 2/2/09 12:01am
UPDATE
Sorry guys, entirely my fault. I have a variable mistyped. Thanks for your answers!