一个时间转换的问题(50)

H

himoo

Unregistered / Unconfirmed
GUEST, unregistred user!
NowTime := Trunc(86400 * (Now - UnixDateDelta - strtodatetime('08:00:00')))
通过这种方式得到的一个当前时间的数字,如何再转换成 日期时间值?如 NowTime=1257917468 想转化成2009年11月11日 13时xx分xx秒
 
B

Buddy.Sun

Unregistered / Unconfirmed
GUEST, unregistred user!
你是要得到字符串还是TDateTime类型的值啊看看下句,你根据需要自己就可以得到自己的东西了ShowMessage(FormatDateTime('YYYY年MM月DD日 HH时MM分SS秒', 1234.567));
 
D

de410

Unregistered / Unconfirmed
GUEST, unregistred user!
function DateTimeToUnix(const AValue: TDateTime): Int64;//日期时间转整数begin Result := Round((AValue - UnixDateDelta) * SecsPerDay);end;function UnixToDateTime(const AValue: Int64): TDateTime;//整数转日期时间begin Result := AValue / SecsPerDay + UnixDateDelta;end;
 
H

himoo

Unregistered / Unconfirmed
GUEST, unregistred user!
ShowMessage(FormatDateTime('YYYY年MM月DD日 HH时MM分SS秒', (1257917468+28800 )/ SecsPerDay + UnixDateDelta));
 

Similar threads

S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
914
SUNSTONE的Delphi笔记
S
S
回复
0
查看
745
SUNSTONE的Delphi笔记
S
顶部