youknowwho4eva Posted September 4, 2008 Share Posted September 4, 2008 How do you make the hour return in 12 hour format instead of 24 hour format? I would search 12 Hour format but search doesn't allow words of less then 3 characters . Giggity Link to comment Share on other sites More sharing options...
Prab Posted September 4, 2008 Share Posted September 4, 2008 If you are talking about the @hour macro just subtract 12. $hour = @HOUR $string = "AM" If $hour > 12 Then $hour -= 12 $string = "PM" EndIf MsgBox(0,"", $hour & " " & $string) FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 4, 2008 Share Posted September 4, 2008 If you are talking about the @hour macro just subtract 12. $hour = @HOUR $string = "AM" If $hour > 12 Then $hour -= 12 $string = "PM" EndIf MsgBox(0,"", $hour & " " & $string) It's almost, but not quite that simple. In your script, 00 hours in the morning would stay 00, not 12 AM. Also 12 noon would stay AM vice PM. Try: Global $iHour = @HOUR, $sAMPM = "AM" If $iHour >= 12 Then $sAMPM = "PM" If $iHour = 00 Then $iHour = 12 If $iHour > 12 Then $iHour -= 12 MsgBox(64, "12H Time", "It's " & $iHour & ":" & @MIN & " " & $sAMPM) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Prab Posted September 4, 2008 Share Posted September 4, 2008 Oops, Forgot about that. Good catch. FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
youknowwho4eva Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) How did I not think of that? Thank you much sir. I guess I was looking to hard to find a one liner instead of thinking to subtract 12. Isn't midnight displayed as 00? (the range says 00 to 23)No one should be on my program at midnight, but just to be accurate I'd have to add the extra if $hour = 0 then $hour += 12. Edit: Psatlyds beat me to it Edited September 4, 2008 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now