Re: Military <-> Standard times

From: Date: Wed, 21 Jan 2009 19:50:02 +0000
Subject: Re: Military <-> Standard times
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-286939@lists.php.net to get a copy of this message
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@sperling.com> 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 > >

« previous php.general (#286939) next »