Teckx Posted July 10, 2017 Share Posted July 10, 2017 (edited) This is what I have so far and it works great. Just need to get the AM PM thing going instead of military. BTW I am adding 3 hours to the stamp Send(@MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR +3 & ":" & @MIN & ":" & @SEC) 07/10/2017 13:56:29 I would like it to look like this 07/10/2017 1:56:29 PM Edited July 10, 2017 by Teckx Link to comment Share on other sites More sharing options...
anthonyjr2 Posted July 10, 2017 Share Posted July 10, 2017 (edited) You can use _Now() by itself that does exactly what you want. Send(_Now()) EDIT: Just saw that you're also adding 3 hours to the time. In that case I recommend grabbing the @HOUR macro and then converting it to normal time by subtracting 12 if necessary. Something like: $hr = @HOUR $am = True If($hr > 12) Then $hr = $hr - 12 $am = False EndIf You should be able to do something similar to that and incorporate it into your code. Edited July 10, 2017 by anthonyjr2 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
mikell Posted July 10, 2017 Share Posted July 10, 2017 (edited) Not so easy. After 21:00 (9:00 PM) if 3 hours are added then the day changes... and so on #include <Date.au3> ; first: add 3 hours to current date/time and split the result Local $d, $t _DateTimeSplit(_DateAdd("h", 3, _NowCalc()), $d, $t) ; second: format as needed and put the am/pm thing $time = $d[3] & "/" & $d[2] & "/" & $d[1] & " " & _ StringFormat("%02d:%02d:%02d", Mod($t[1], 12), $t[2], $t[3]) & " " & _ (Floor($t[1]/12) = 0 ? "AM" : "PM") Msgbox(0,"", $time) Edited July 10, 2017 by mikell added comments Teckx 1 Link to comment Share on other sites More sharing options...
anthonyjr2 Posted July 10, 2017 Share Posted July 10, 2017 Yeah you're right, I was still half asleep when I wrote that so I didn't consider the other edge possibilities UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
mikell Posted July 10, 2017 Share Posted July 10, 2017 2 minutes ago, anthonyjr2 said: the other edge possibilities Back to the future Link to comment Share on other sites More sharing options...
Teckx Posted July 10, 2017 Author Share Posted July 10, 2017 17 minutes ago, mikell said: Not so easy. After 21:00 (9:00 PM) if 3 hours are added then the day changes... and so on #include <Date.au3> ; first: add 3 hours to current date/time and split the result Local $d, $t _DateTimeSplit(_DateAdd("h", 3, _NowCalc()), $d, $t) ; second: format as needed and put the am/pm thing $time = $d[3] & "/" & $d[2] & "/" & $d[1] & " " & _ StringFormat("%02d:%02d:%02d", Mod($t[1], 12), $t[2], $t[3]) & " " & _ (Floor($t[1]/12) = 0 ? "AM" : "PM") Msgbox(0,"", $time) very nice thank you very much Link to comment Share on other sites More sharing options...
Teckx Posted July 10, 2017 Author Share Posted July 10, 2017 (edited) I hate to ask another question after receiving that help from you . Im sure its something simple that I havnt encountered yet how could I bypass it displaying the time in messagebox and have it type at my cursor so $time is a variable but if I do Send("$time") obviously it just sends me $time Edited July 10, 2017 by Teckx english Link to comment Share on other sites More sharing options...
Developers Jos Posted July 10, 2017 Developers Share Posted July 10, 2017 5 minutes ago, Teckx said: I hate to ask another question No you don't. 5 minutes ago, Teckx said: so $time is a variable but if I do Send("$time") obviously it just sends me $time And why do you think this is the case? maybe you have something around the variable making it a literal string? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teckx Posted July 10, 2017 Author Share Posted July 10, 2017 Just now, Jos said: No you don't. And why do you think this is the case? maybe you have something around the variable making it a literal string? Jos yea I tried without the quotes and receive .. you know what it didn't work 5 minutes ago now it does. A Magician you are, Master Yoda Link to comment Share on other sites More sharing options...
Developers Jos Posted July 10, 2017 Developers Share Posted July 10, 2017 Just now, Teckx said: you know what it didn't work 5 minutes ago now it does. Bullshit ... and you know it! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teckx Posted July 10, 2017 Author Share Posted July 10, 2017 there may have been some user error involved Link to comment Share on other sites More sharing options...
mikell Posted July 10, 2017 Share Posted July 10, 2017 1 hour ago, Teckx said: A Magician you are, Master Yoda How true 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