Jump to content

Force 12-hour Time format..?


 Share

Recommended Posts

doing a search for "12 hour time", I found this:

http://www.autoitscript.com/forum/index.ph...hl=12+hour+time

Which is basically rolling your own logic. I tweaked it slightly.

msgbox(64,"Current time", "It is currently " & time12hr())

Func time12hr()
    $iHour = @HOUR 
    $iMin  = @MIN
    $iSec  = @SEC
    $sAMPM = "AM"
    If $iHour >= 12 Then $sAMPM = "PM"
    If $iHour = 00 Then $iHour = 12
    If $iHour > 12 Then $iHour -= 12
    Return $iHour & ":" & $iMin & ":" & $iSec & " "& $sAMPM
EndFunc
Link to comment
Share on other sites

doing a search for "12 hour time", I found this:

http://www.autoitscript.com/forum/index.ph...hl=12+hour+time

Which is basically rolling your own logic. I tweaked it slightly.

msgbox(64,"Current time", "It is currently " & time12hr())

Func time12hr()
    $iHour = @HOUR 
    $iMin  = @MIN
    $iSec  = @SEC
    $sAMPM = "AM"
    If $iHour >= 12 Then $sAMPM = "PM"
    If $iHour = 00 Then $iHour = 12
    If $iHour > 12 Then $iHour -= 12
    Return $iHour & ":" & $iMin & ":" & $iSec & " "& $sAMPM
EndFunc
This should be a UDF...

If a minor change like the one between StringSplit() and _StringSplit() can make one a UDF, this should deffinately be a UDF... :)

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...