lua 中的 OLE 自动化日期
OLE Automation date in lua
好的,我真的需要 lua 中的 OLE 自动化日期。
来自here:
public double ToOADate()
Return Value Type: System.Double A double-precision floating-point
number that contains an OLE Automation date equivalent to the value of
this instance.
所以在 C# 中:
Console.Write("DateTime.Now.ToOADate() = " + DateTime.Now.ToOADate());
给我这个:
DateTime.Now.ToOADate() = 42146,4748270602
在 Lua 中获取模拟值的最佳方法是什么?
更多细节,基于 EgorSkriptunoff 的回答。
所以,Lua 代码对我来说工作得很好,可以在 lua:
中获取 OLE 自动化日期
-- number of days between December, 30 1899 and January, 1 1970
local magicnumber = 25569
-- don't forget about time zone (UTC+3 for my case)
local utcshift = 3*3600
-- calc and print for test
local oleadate = magicnumber + ((os.time()+utcshift)/(3600*24))
print(oleadate)
输出:
42146.575740741
好的,我真的需要 lua 中的 OLE 自动化日期。
来自here:
public double ToOADate()
Return Value Type: System.Double A double-precision floating-point number that contains an OLE Automation date equivalent to the value of this instance.
所以在 C# 中:
Console.Write("DateTime.Now.ToOADate() = " + DateTime.Now.ToOADate());
给我这个:
DateTime.Now.ToOADate() = 42146,4748270602
在 Lua 中获取模拟值的最佳方法是什么?
更多细节,基于 EgorSkriptunoff 的回答。
所以,Lua 代码对我来说工作得很好,可以在 lua:
中获取 OLE 自动化日期-- number of days between December, 30 1899 and January, 1 1970
local magicnumber = 25569
-- don't forget about time zone (UTC+3 for my case)
local utcshift = 3*3600
-- calc and print for test
local oleadate = magicnumber + ((os.time()+utcshift)/(3600*24))
print(oleadate)
输出:
42146.575740741