airsoftsoftwair wrote:What do you mean by "long numerical timestamp"? What exactly do you want to have?
My guess would have been Unix time stamp, but as the numerical stamp on the first code box don't match with the date and time on the second code box... I am not really sure...
Anyway, code to convert to Unix time stamp would be something like:
Code: Select all
; Based on BlitzMax code by Zethrax
Function ToUnixTime(date, time)
Local date = SplitStr(date, ".")
Local time = SplitStr(time, ":")
Local days = ToNumber(date[0])
Local year = ToNumber(date[2])
Local month = ToNumber(date[1])
Local end_year
If month > 2
end_year = year
Else
end_year = year - 1
EndIf
For Local y = 1970 To end_year
If Mod(y, 100) = 0
If Mod(y, 400) = 0
days = days + 1
EndIf
ElseIf Mod(y, 4) = 0
days = days + 1
EndIf
Next
days = days + (year - 1970) * 365
If month > 1 Then days = days + 31
If month > 2 Then days = days + 28
If month > 3 Then days = days + 31
If month > 4 Then days = days + 30
If month > 5 Then days = days + 31
If month > 6 Then days = days + 30
If month > 7 Then days = days + 31
If month > 8 Then days = days + 31
If month > 9 Then days = days + 30
If month > 10 Then days = days + 31
If month > 11 Then days = days + 30
If month > 12 Then days = days + 31
Local hour = ToNumber(time[0])
Local minutes = ToNumber(time[1])
Local seconds = ToNumber(time[2])
Return(days * 86400 + hour * 3600 + minutes * 60 + seconds)
EndFunction
You can test it with the following code and use some converter available on net to verify the result.
Code: Select all
DebugPrint(ToUnixTime(GetDate(), GetTime(True)))