Mario Kulka wrote:
> hi,
> My form asks for the time in the format hh? mm? am/pm?
> However before I combine it all into one value (so I can insert it
> into my MySQL table) I would like to change the format to military
> time. I thought I could simply add 12 to the "hh" value when "am/pm"
> is pm, which works fine except for 12:00AM.
> So I wrote:
>
> if ((($ampm eq 'PM')&&($hh != 12))||(($hh == 12) && ($ampm eq
> 'AM'))){$hh = $hh + 12;}
>
> This seems to work but there must be a standard (prettier way:) to
> acomplish the same. Or is that fine?

    $hh = 0 if $hh == 12;
    $hh += 12 if $ampm =~ /p/i;

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to