![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Tue, Jan 24 2017 12:52 PM | Permanent Link |
KimHJ Comca Systems, Inc | I have created a Web Service using EWB Module latest version I'm also using the EDB for the database.
I have a service were a customer can request a service date and the Module will add a day to today's date if it's after 12noon. The problem is that I host it on a server that is not on the same time zone so when I use the Date and Time in Delphi I get the local time of were the server is. The same goes for the EDB I save the time using CURRENT_TIME and date using CURRENT_DATE. Is there anyway I can say give me the date (UTC-5). Thanks, Kim |
Tue, Jan 24 2017 7:44 PM | Permanent Link |
KimHJ Comca Systems, Inc | After digging around the most of the day I found that the best way to do this, is to save all my time and dates as UTC. I found that in EDB I just have to add the CURRENT_DATE(UTC) to get the UTC date and the same for time.
Then I use this in my module to convert the UTC to the current local time and date. function UTCToLocalTime(UTCTime: TDateTime; TimeZone: Integer): TDateTime; var UTCST: TSystemTime; LocalST: TSystemTime; TZI:TTimeZoneInformation; begin TZI.Bias := -(60*60)*TimeZone; GetTimeZoneInformation(tzi); DateTimeToSystemTime(UTZTime, UTZST); Win32Check(SystemTimeToTzSpecificLocalTime(@TZI, UTZST, LocalST)); Result := SystemTimeToDateTime(LocalST); end; Just in case someone else need it. Kim |
Wed, Jan 25 2017 4:36 AM | Permanent Link |
Matthew Jones | KimHJ wrote:
> to convert the UTC to the current local time and date. Having just looked into this myself, XE2 introduced TTimeZone.Local.ToUniversalTime(Now); and similar functions. This may make some things tidier/easier. -- Matthew Jones |
Wed, Jan 25 2017 6:51 PM | Permanent Link |
KimHJ Comca Systems, Inc | "Matthew Jones" wrote:
KimHJ wrote: > to convert the UTC to the current local time and date. >>Having just looked into this myself, XE2 introduced TTimeZone.Local.ToUniversalTime(Now); and similar >>functions. This may make some things tidier/easier. I looked into that as well but I could not find a way to change the UTC to a specific timezone. 'Now' will still be the TimeZone of the server and that server could be in Australia and I may need EST or CST. Kim |
Thu, Jan 26 2017 4:23 AM | Permanent Link |
Matthew Jones | KimHJ wrote:
> I could not find a way to change the UTC to a specific timezone I saw something about that in my searches, so it can be done. -- Matthew Jones |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |