Code: Select all
[Datetime]130814384725063210 => Wednesday, 15. Juli 0415 12:54:32
[Datetime]10000000 => Monday, 1. Januar 0001 00:00:01
1 Second = 10000000
1 Second / 10000000 = 100 Nanoseconds
Not with WinAPI (DllCall)
I think the problem here is the
FILETIME structure
Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
A.
GetDateFormat works with minimum Date
160101010000000 (Monday, 01. Januar 1601)
Code: Select all
MsgBox % GetDateFormat(160101010000000) ; ==> Monday, 01. Januar 1601
GetDateFormat(Date, Format := "dddd',' dd. MMMM yyyy")
{
VarSetCapacity(SYSTEMTIME, 16)
, NumPut(SubStr(Date, 1, 4), SYSTEMTIME, 0, "UShort")
, NumPut(SubStr(Date, 5, 2), SYSTEMTIME, 2, "UShort")
, NumPut(SubStr(Date, 7, 2), SYSTEMTIME, 6, "UShort")
size := DllCall("GetDateFormat", "UInt", 0x0400, "UInt", 0, "Ptr", &SYSTEMTIME, "Ptr", &Format, "Ptr", 0, "Int", 0)
VarSetCapacity(buf, size * (A_IsUnicode ? 2 : 1), 0)
if !(DllCall("GetDateFormat", "UInt", 0x0400, "UInt", 0, "Ptr", &SYSTEMTIME, "Ptr", &Format, "Str", buf, "Int", size))
return "*" A_LastError
return buf
}
B.
commands/FormatTime.htm works with minimum Date
1601010100000000 (Monday, 01. Januar 1601 12:00:00)
Code: Select all
FormatTime, TimeString, 1601010100000000, dddd, dd. MMMM yyyy hh:mm:ss
MsgBox % TimeString ; ==> Monday, 01. Januar 1601 12:00:00
but... it looks like it is somehow possible with FormatTime
Although only years between 1601 and 9999 are supported, a formatted time can still be produced for earlier years as long as the time portion is valid.
Maybe someone else has an idea to format this