Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-24 22:27:16

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

strtotime help

I’m trying to parse the dateTaken field from Flickr’s RSS feed for a plugin. Unfortunately:

2007-07-04T22:04:27-08:00

returns ‘-1’ when I run strtotime(). Any thoughts on how to parse this string into a valid datetime?

Offline

#2 2007-11-25 00:19:06

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: strtotime help

convert it from 2007-07-04T22:04:27-08:00 to 2007-07-04 22:04:27 -08:00 and then feed it to strtotime:

$time = strtotime(preg_replace('/^(.{10}).(.{8})(.+)$/', '$1 $2 $3', $flickr_date));

Offline

#3 2007-11-25 04:04:35

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: strtotime help

see, developers like you are why i sit here in awe all day

Thanks :)

Offline

Board footer

Powered by FluxBB