So we have an app writing a date time in UTC time, which I get. However, we will have to translate that to usable local times. Is there a standard/built in way to do this? Or is this an offset thing. I see the BAQ has local in the format, but they all say that. Should my app be writing in Local time or UTC?
Brandon,
You may be able to use the Site Configuration Time Zone Offset to handle this.
In a BAQ you can query for the PlantConfCtrl.TimeOffsetSec (or TimeOffset for hrs) where Plant = BAQ CurrentPlant constant. This will dynamically give the BAQ the current user’s plant. From there you can use either of those values in a calc field similar to this(here I’m just working with Epicor’s current seconds from midnight constant):
CONVERT(varchar, DATEADD(ss, Constants.CurrentTime + PlantConfCtrl.TimeOffsetSec, 0), 108)
This of course is dependent on the Site’s Time Zone offset being set correctly and the current user is in the ‘correct’ plant. I don’t know of a way to get at the current user’s client time from within a BAQ. You can probably do it with a customization, but I don’t think that is where you were going with this.
-Rick
www.getaligned.solutions
If you did that, wouldn’t you have to adjust by date then? That seems to be the trouble everyone else is having with dealing with UTC vs Local time in SQL. If I offset by say 4 hours for sake of argument, depending on if I am looking at a time recorded in January or July, it would be a different offset due to the asinine government program called daylight savings time right?
I think we are going to be better off recording local time since we only have one location, and luckily I am building a new process and don’t have to deal with history. But I can see this being a rough problem to deal with for a lot of things.