Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 19 total |
UTC and LocalTime |
Mon, Sep 25 2017 12:04 PM | Permanent Link |
KimHJ Comca Systems, Inc | I'm using EDB 2.26 build 4 and EWB 2.06 build 5
I save all time and dates in UTC. The Web server have the timezone set to UTC. I have the LocalizeDateTimeColumns set to True. I display the data in a grid with the Dataset set to the Table. In the EDB on the Web Server it shows: date 9/27/2017 and time 15:36 I'm open the web page on a computer with the timezone set to EST. On the Web in the grid it shows: date shows 9/26/2017 and the time shows 11:36 AM It should show 9/27/2017 and 10:36 AM What did I do wrong? Kim |
Tue, Sep 26 2017 8:16 PM | Permanent Link |
KimHJ Comca Systems, Inc | I have been watching everyday and it looks like the time column is right, but the date column is always one day of.
25 shows 24, 26 shows 25. Is it because it is just a date column with no time that it can convert to the right date? Help. Kim |
Fri, Sep 29 2017 3:19 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Kim,
<< I'm using EDB 2.26 build 4 and EWB 2.06 build 5 I save all time and dates in UTC. The Web server have the timezone set to UTC. I have the LocalizeDateTimeColumns set to True. >> Do you have the LocalizeDateTimeColumns property set for both the EWB application's dataset *and* the dataset definition on the EWB Web Server ? If so, then that means that the EWB Web Server is going to try to convert the date/time *from* a local time before sending it back to the EWB browser application, which will then also try to localize the date/time to the browser's local time when displaying it as a string in the grid. Tim Young Elevate Software www.elevatesoft.com |
Fri, Oct 6 2017 1:54 PM | Permanent Link |
KimHJ Comca Systems, Inc | Tim Young [Elevate Software] wrote:
<<Do you have the LocalizeDateTimeColumns property set for both the EWB application's dataset *and* the dataset definition on the EWB Web Server ? If so, then that means that the EWB Web Server is going to try to convert the date/time *from* a local time before sending it back to the EWB browser application, which will then also try to localize the date/time to the browser's local time when displaying it as a string in the grid.>> Tim In the EWB application I have all Dataset LocalizeDateTimeColumns set to True In the ewbsrvr.ini all Dataset is set to LocalizeDateTimeColumns=1 Here is an example I have a dataset with the column TimeStamp, Date, Time and Date all UTC as default. Here is what shows in the database. 2017-10-06 17:13:11.950 2017-10-06 17:13:11.950 In the application on a computer set to EST it shows: 10/06/2017 1:13 pm 10/05/2017 12:13 pm I have attached a screen shot. Also look at the Request Date which is a Date column and in the database it shows 2017-10-07 The Timestamp shows the right date and time The Date column shows the wrong date it is one day off The Time column shows the wrong time it is one hour off If I have to I can change everything to TimeStamp the only one where it will be a problem is when the user request a pickup date (Request Date) I will only receive the date which I can save with a time like 12:00:00 but I only want to show the date in the grid. Kim Attachments: Kim_2017-10-06.png |
Fri, Oct 6 2017 2:24 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Kim,
<< Here is what shows in the database. >> Is this using the EDB Manager ? Can you send me the database catalog and table files for the table in question ? I'll take a look here and see what the issue is. Tim Young Elevate Software www.elevatesoft.com |
Fri, Oct 6 2017 4:27 PM | Permanent Link |
KimHJ Comca Systems, Inc | Tim Young [Elevate Software] wrote:
<<Is this using the EDB Manager ? Can you send me the database catalog and table files for the table in question ?>> Yes using the EDB manager on the web server which have the timezone set to UTC. The date I can understand because if it have no time information and using 0:00:00 then 10/06/2017 - 4 hours will be the day before. Is there away to add the time to the date field so it would use that time. I emailed you a backup of the test data base. Kim |
Fri, Oct 6 2017 6:58 PM | Permanent Link |
Walter Matte Tactical Business Corporation | Here are some helper functions I use....
function NowFix : DateTime; begin result := Now - (TimeZoneOffSet(now) * 60 * 1000); end; // Example DateFix: // wd := TimeSum.Columns['Workdate'].asDateTime + DateFix(TimeSum.Columns['Workdate'].asDateTime); function DateFix(dt : DateTime) : Integer; begin result := (TimeZoneOffSet(dt) * 60 * 1000); end; Walter |
Fri, Oct 6 2017 7:51 PM | Permanent Link |
KimHJ Comca Systems, Inc | Walter Matte wrote:
<<Here are some helper functions I use....>> Thanks Walter, I have functions in my modules that convert UTC to the local date and time, my problem is in the web app grid that is connect to the dataset. Do you manually load you grid and use those function to change the UTC to local? Kim |
Sat, Oct 7 2017 4:06 PM | Permanent Link |
Walter Matte Tactical Business Corporation | No I do not load the grid manually.
I don't use EWB Server. I use a Server I wrote. My server emulates what the EWB Server does. My server sends values as they are stored - it does not change them to UTC. sValue := IntToStr(DateTimeToUnixTimeFast(dsData.Fields[i].AsDateTime)); My datasets have LocalizeDateTimeColumns := False; function DateTimeToUNIXTimeFAST(DelphiTime : TDateTime): Int64; const MsecPerDay : int64 = 86400000; DayDiff : int64 = 25569; var DT : TDateTime; X : extended; begin DT := DelphiTime; // swap x := (DT - DayDiff) * MsecPerDay; result := round(X); end; In my server the commit saves converts unit to delphi tbX.FieldByName(jafter.ValueByIndex[j].Name).AsDateTime := UNIXTimeToTimeFAST(jafter.ValueByIndex[j].AsInt64); function UNIXTimeToTimeFAST(UnixTime: Int64): TDateTime; const MsecPerDay : int64 = 86400000; DayDiff : int64 = 25569; var DT : TDateTime; begin DT := (UnixTime / MsecPerDay); result := DT; // swap end; Walter |
Mon, Oct 9 2017 4:21 AM | Permanent Link |
Matthew Jones | Walter Matte wrote:
> My server sends values as they are stored - it does not change them to UTC. > > sValue := IntToStr(DateTimeToUnixTimeFast(dsData.Fields[i].AsDateTime)); It would, I think, be worth documenting a few of those values given you will see them going by. And that would then allow you to write a test example that shows the problem by plugging those values into the browser part directly. This should allow identification of the problem area. -- Matthew Jones |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 14, 2024 at 07:14 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |