How to get current time of the day in seconds? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

How to get current time of the day in seconds?

21 Apr 2018, 23:44

How to get current time of the day in seconds? I mean to get something like: 600 , which means that current time is 00:10 AM.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to get current time of the day in seconds?  Topic is solved

22 Apr 2018, 00:06

Here are two examples.

Code: Select all

q:: ;time at 00:10 AM (seconds)
vDate := SubStr(A_Now, 1, 8) "001000"
FormatTime, vDate, % vDate, HH:mm:ss
oTemp := StrSplit(vDate, ":")
vSec := oTemp.1*3600+oTemp.2*60+oTemp.3
MsgBox, % vSec
return

w:: ;time now (seconds)
FormatTime, vDate,, HH:mm:ss
oTemp := StrSplit(vDate, ":")
vSec := oTemp.1*3600+oTemp.2*60+oTemp.3
MsgBox, % vSec
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: How to get current time of the day in seconds?

22 Apr 2018, 00:37

jeeswg

Thank you :)
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
just me
Posts: 9459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to get current time of the day in seconds?

22 Apr 2018, 01:09

:arrow: EnvSub

Code: Select all

Seconds := A_Now
Seconds -= % SubStr(Seconds, 1, 8), S
MsgBox, %Seconds%

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Rohwedder and 311 guests