On 23/06/11 1:02 AM, Stuart Dallas wrote:

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]);


Thanks, Stuart.  That's much prettier!


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to