![]() |
Delphi-Version: 2010
Timestamp to valid Delphi's datetime
I want to know datatime of PE compilation. So, I learned a bit about PE and finally got TimeDateStamp field in PE header. Unfortunately this is cardinal value and it's useless in Delphi. So, I performed conversion:
Delphi-Quellcode:
FormatDateTime('c', EncodeDate(1970, 1, 1) + h.TimeDateStamp / 86400)
Code:
Result is 2hrs back. Question: I did wrong conversion or need to add 2hrs in any case?
TimeDateStamp = 1379407669
DateTime = 17.09.13 08:47:49 |
AW: Timestamp to valid Delphi's datetime
You have to adapt to your timezone. Timestamp is GMT
|
Re: Timestamp to valid Delphi's datetime
Hm, I don't know how, because timestamp is -2, but my GMT is +1.
I have:
Delphi-Quellcode:
(EncodeDate(1970, 1, 1) + 1379407669 {timestamp} / 86400) + ((1 / 24) {hour} + (TimeZone.Bias / 60);
|
AW: Timestamp to valid Delphi's datetime
Try DateUtils.TTimeZone.Local.ToLocalTime(your DateTime-value).
|
Re: Timestamp to valid Delphi's datetime
This is for DXE2+, I guess? I have D2010 and such goodies are absent. How to in 'old classic' style?
|
AW: Re: Timestamp to valid Delphi's datetime
Zitat:
|
Re: AW: Re: Timestamp to valid Delphi's datetime
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:35 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz