Re: How to convert RSS dates to second since epoch?



On Mar 28, 11:41 pm, Duke of Hazard <squ...@xxxxxxxxxxxxxxxxxxx>
wrote:
Any suggestions apart from brute force to convert a date like this:

2008-03-23T20:58:50-04:00

to seconds since 1970 ?

Did some googling and found this, but it give :50 for seconds, instead
of 50:

function parse_w3cdtf ( $date_str ) {

# regex to match wc3dtf
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-
+])(\d{2}):?(\d{2})|(Z))?/";

if ( preg_match( $pat, $date_str, $match ) ) {
list( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4],
$match[5], $match[6]);
.



Relevant Pages

  • Re: Regx to remove all characters after a match
    ... Duke of Hazard wrote: ... it to match a newline as well then you have to use the /s option: ... John ...
    (comp.lang.perl.misc)
  • Re: Defining 3D array
    ... Duke of Hazard wrote in comp.lang.perl.misc: ... > I have searched google, but could not find an answer for how to define ... Anno ...
    (comp.lang.perl.misc)
  • Re: Defining 3D array
    ... http://www.lowth.com/blist/-/4045/1: The best perl scripting books ... "Duke of Hazard" wrote in message ... > I have searched google, but could not find an answer for how to define ...
    (comp.lang.perl.misc)
  • Re: Why are most older people brush passers?
    ... Duke of Hazard wrote: ... 70+ year old drivers? ... give 'em credit for getting out in the woods. ...
    (rec.bicycles.misc)
  • WIN! RIZLA JUKEBOX!
    ... Duke of Bourbon ... Dukes of Hazard ... Prev by Date: ...
    (uk.rec.competitions)