Re: newbie date time question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-Stuart


Thanks, Stuart.  That's much prettier!

DN

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux