从 NSIS 中的时间戳获取日期
Get date from timestamp in NSIS
我是 NSIS 的新手,我想从给定的时间戳中获取日期、小时、分钟等。
有什么办法吗?
提前感谢您的任何回答...
!include LogicLib.nsh
Section
StrCpy [=10=] 1568807339 ; UNIX time
System::Int64Op [=10=] * 10000000
System::Int64Op 116444736000000000 + ; support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime
System::Call 'KERNEL32::FileTimeToLocalFileTime(*ls,*l.s)' ; This line is optional, comment it out if you want to keep it UTC
System::Call 'KERNEL32::FileTimeToSystemTime(*ls,@r0)i.r1' ; NSIS v3+
${If} <> 0
System::Call '*[=10=](&i2.r1,&i2.r2,&i2,&i2.r3,&i2.r4,&i2.r5,&i2.r6)'
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
DetailPrint "// ::"
System::Call 'KERNEL32::GetDateFormat(i0x0400,i0,pr0,p0,t.r1,i666)'
System::Call 'KERNEL32::GetTimeFormat(i0x0400,i0,pr0,p0,t.r2,i666)'
DetailPrint " "
${EndIf}
SectionEnd
我是 NSIS 的新手,我想从给定的时间戳中获取日期、小时、分钟等。
有什么办法吗?
提前感谢您的任何回答...
!include LogicLib.nsh
Section
StrCpy [=10=] 1568807339 ; UNIX time
System::Int64Op [=10=] * 10000000
System::Int64Op 116444736000000000 + ; support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime
System::Call 'KERNEL32::FileTimeToLocalFileTime(*ls,*l.s)' ; This line is optional, comment it out if you want to keep it UTC
System::Call 'KERNEL32::FileTimeToSystemTime(*ls,@r0)i.r1' ; NSIS v3+
${If} <> 0
System::Call '*[=10=](&i2.r1,&i2.r2,&i2,&i2.r3,&i2.r4,&i2.r5,&i2.r6)'
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
IntFmt "%.2d"
DetailPrint "// ::"
System::Call 'KERNEL32::GetDateFormat(i0x0400,i0,pr0,p0,t.r1,i666)'
System::Call 'KERNEL32::GetTimeFormat(i0x0400,i0,pr0,p0,t.r2,i666)'
DetailPrint " "
${EndIf}
SectionEnd