Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 11 to 13 of 13 total |
DateTime (EWB) <-> TDateTime (Delphi) |
Wed, Jul 20 2016 3:55 AM | Permanent Link |
thomh | >>The EWB time functions have an optional USEUTC parameter except DateTimeToISOStr() which I believe always converts to UTC time, which >>we old farts call Grenich mean time..
Hi Erick, Yeah, but the DateTimeToISOStr is used when you pass dtfISO8601 to the TWriter constructor. "Append(IntToStr(Integer(Value)))" is just typecasting the DateTime value. So I would assume code like this: var LDate: DateTime; begin LDate := Date; end; would contain an integer value representation of today's date. But when I use Walter's method above in Delphi to convert this to a Delphi TDateTime I get this: 19/07/16 22:00:00 Now, if I write: LDate := Now; I get this: 20/07/16 07:50:25 which has the correct date but uses GMT. I have my PC set to (UTC+01:00) Brussels, Copenhagen, Madrid, Paris so the correct time should be 09:50:25. // Thom |
Wed, Jul 20 2016 6:09 AM | Permanent Link |
Walter Matte Tactical Business Corporation | I wrote my own server too, so I convert date and time as they are locally - I don't want localization most of the time.. But EWB will localize date to the timezone. I don't want that 99% of the time. So I adjust on the EWB side. function NowFix : DateTime; begin result := Now - (TimeZoneOffSet(now) * 60 * 1000); end; // DisplayDate is my own routine to format dates - but AsDateTime will localize so I correct to unlocalize function TfrmTime.TimeDetWorkDateGetText(Sender: TObject; const Value: String): String; begin result := DisplayDate(TimeDet.Columns['WorkDate'].AsDateTime + (TimeZoneOffSet(now) * 60 * 1000), 2); end; Walter |
Wed, Jul 20 2016 11:45 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Thom,
<< What do you mean "localize DateTime values" ? >> When you use the Date() function, you're getting a DateTime value that is the number of msecs since midnight, January 1, 1970, UTC. If you pass this to your server-side code, then you may need to convert the date from UTC to local time in order to have any database updates, etc. reflect the local time instead of the UTC time. Tim Young Elevate Software www.elevatesoft.com |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |