If you type [Datetime]130814384725063210 into powershell it returns the date. Anyone know how to convert this information in AHK?
Appreciate any help
![Smile :)](./images/smilies/icon_e_smile.gif)
Mikael
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
A. GetDateFormat works with minimum Date 160101010000000 (Monday, 01. Januar 1601)Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
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
}
Code: Select all
FormatTime, TimeString, 1601010100000000, dddd, dd. MMMM yyyy hh:mm:ss
MsgBox % TimeString ; ==> Monday, 01. Januar 1601 12:00:00
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.
Code: Select all
[DATETIME]130822047195938865 ==> Friday, 24. July 0415 09:45:19
Code: Select all
MsgBox % FileGetTime("C:\Windows\System32\calc.exe")
FileGetTime(File, Mode := "M") ; by SKAN
{
if (VarSetCapacity($, 342, 0) && (H := DllCall("FindFirstFile", "Str", File, "Ptr", &$)))
{
DllCall("FindClose", "Ptr", H), VC := &$ + 4, VA := &$ + 12, VM := &$ + 20, FT := V%Mode%
LFT := &$ + 318 , DllCall("FileTimeToLocalFileTime", "Ptr", FT, "Ptr", LFT)
ST := LFT + 8 , DllCall("FileTimeToSystemTime", "Ptr", LFT, "Ptr", ST)
loop 7
T .= StrLen(N:= NumGet(ST + 0, (A_Index - 1) * 2, "UShort")) < 2 ? "0" N : N
return SubStr(T, 1, 6) SubStr(T, 9, 8) SubStr("00" NumGet(ST + 0, 14, "UShort"), -2)
}
}
Code: Select all
FileTicks := 130824030856564401
FileSeconds := FileTicks // 10000000
DateTimeUTC := 1601
DateTimeUTC += FileSeconds, S
LocalTicks := FileTimeToLocalFileTime(FileTicks)
FileSeconds := LocalTicks // 10000000
DateTimeLoc := 1601
DateTimeLoc += FileSeconds, S
MsgBox, UTC:`n%DateTimeUTC%`nLocal:`n%DateTimeLoc%
FileTimeToLocalFileTime(FileTicks) { ; 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC)
VarSetCapacity(FileTime, 8, 0)
VarSetCapacity(LocalTime, 8, 0)
NumPut(FileTicks, FileTime, "UInt64")
DllCall("FileTimeToLocalFileTime", "Ptr", &FileTime, "Ptr", &LocalTime)
Return NumGet(LocalTime, "UInt64")
}
What do you get if you add 04 to 16?Date is correct, but year should be 2015, not 0415
Users browsing this forum: No registered users and 374 guests