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

Re: [MacPerl] Converting Military Time to Regular Time...



sub mil2std()
{
	my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
	my $ampm = "am";
	if( $hour > 12 ){
		$ampm = "pm";
		$hour -= 12;
		}

	return sprintf( "%.2d:%.2d %s", $hour, $min, $ampm );
}

If you want to do the seconds just add in another ":%.2d" and $sec to
the above sprintf.

--------------------------------------------------------------------------------
All e-mail needs to be sent to mark@cheers.jsc.nasa.gov.  If you don't,
it will
probably bounce.  What man does not understand or fears; he ultimately
destroys.
Steve Wright: Black holes are where God divided by zero.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch