Re: Military <-> Standard times

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

 



Umm I don't think there is a better option, you probably can return the
output straight:

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

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

But it doesn't really matter.

On Wed, Jan 21, 2009 at 9:16 PM, tedd <tedd@xxxxxxxxxxxx> wrote:

> 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