Military <-> Standard times

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

 



Hi gang:

What's the slickest way to go from "standard" to military times and back again?

Such as:

0800 -> 8:00am
8:00am -> 0800

-- or --

1600 -> 4:00pm
4:00pm -> 1600

I use the following functions, but is there anything better?

function standardToMilitary($t)
   {
   $t = strftime('%R', strtotime($t));
   return $t;
   }

function militaryToStandard($t)
   {
   $t = strftime('%r', strtotime($t));
   return $t;
   }

Thanks,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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