Skip to content

Instantly share code, notes, and snippets.

@dufferzafar
Created November 20, 2013 12:25
Show Gist options
  • Save dufferzafar/7562344 to your computer and use it in GitHub Desktop.
Save dufferzafar/7562344 to your computer and use it in GitHub Desktop.
UNIX Timestamps AHK
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