Created
November 20, 2013 12:25
-
-
Save dufferzafar/7562344 to your computer and use it in GitHub Desktop.
UNIX Timestamps AHK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FileGetTime, SubtitleTime, % A_AhkPath, M | |
SecondsDifference := ToTimestamp(A_Now) - ToTimestamp(SubtitleTime) | |
MsgBox, 0, Approve - Subtitle, This file was saved around %SecondsDifference% seconds ago. | |
ToTimestamp(T) { ; By Sir Laszlo himself | |
; Retrieve required data from the input time. | |
FormatTime Y, %T%, yyyy | |
FormatTime D, %T%, YDay | |
FormatTime H, %T%, H | |
FormatTime M, %T%, m | |
FormatTime S, %T%, s | |
; No idea how this works but I trust Laszlo ;) | |
Return (31536000*(Y-1970) + (D+Floor((Y-1972)/4))*86400 + H*3600 + M*60 + S) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment