On Mar 28, 11:41 pm, Duke of Hazard <squ...@peoriadesignweb.com>
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]);