DATETIME.NOW before and after using DISPLAYFORM
Can anyone explain why if I assign a variable with DATETIME.NOW immediately before I use DISPLAYFORM the time is 7 hrs off (early) but when I use it immediately after the DISPLAYFORM, it shows the correct time? What Do I need to do before I use DISPLAYFORM to make it show the correct time?
0
-
This seems like a fascinating issue. I just made a short test with two alerts displaying the current time and a DisplayForm between them, and got the same (correct) result from both alerts. Why do you think it's the form that's causing problems? 0 -
Actually, I think the form is correcting the issue as the time is correct after I display the form, but 7 hr slow before I display the form. Don't know what the form did to correct it, but appears to be GMT minus Daylight savings time difference (as I'm in PST zone) Don't know where the time is being pulled from either (assume the server??). 0 -
Yes, the time comes from the machine running the code (in this case. the server). I still suspect that the issue is elsewhere else in your code, since I can't think of how the displayform would make any difference to the machine.. Perhaps I'm wrong though. In any event you should consider using Datetime.UtcNow (https://msdn.microsoft.com/en-us/library/system.datetime.utcnow.aspx) to get GMT-0 and subtract the appropiate amount of time depending on the date (to handle DST). 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
3 kommentarer