views:

187

answers:

2

So this cant be too difficult, I need a feed date/time converted into a unix timestamp in PHP.

from "2010-04-13T10:00:00.000-04:00" -> Unix

I have been trying all sorts of weird things with date() and strtotime() with no luck. Thank you!

+1  A: 
$dt=new DateTime("2010-04-13T10:00:00.000-04:00");
echo $dt->format('U');
dnagirl
$feedTime = '2010-04-14T08:30:00.000-04:00';strtotime($feedTime);This actually works fine. My problem was my time zone, the above entry resulted in my "hour" being 5 instead of 8, fixed by:date_default_timezone_set('America/New_York');This if for a Google Calendar, now that those two timezones are synced there shouldn't be problems. Thank you for the help.
Prime Studios
+1  A: 

Try this:

$time = strtotime(preg_replace('/(T|\.\d{3})/', ' ', '2010-04-13T10:00:00.000-04:00'));

Here I used preg_replace to replace the T and the milliseconds with single spaces.

Gumbo