Re: newbie date time question

From: Date: Wed, 22 Jun 2011 15:02:54 +0000
Subject: Re: newbie date time question
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-313642@lists.php.net to get a copy of this message
On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: > OK, looks like I have fixed problem, using: > > $format = 'd/m/Y g:i:s A'; > $dt = date_create_from_format($format, $d[0]); > $dt2 = date('r', $dt->getTimestamp()); > $data[] = array(strtotime($dt2), $d[1]); > > Not elegant but it gives me the date/time value. $dt->getTimestamp() will give you the same value as strtotime($dt2), so you don't need the inelegance. $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $data[] = array($dt->getTimestamp(), $d[1]); -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/

« previous php.general (#313642) next »