TimeZone Offset Data

Helper Methods available in BPMs, BAQs, EFx

Ice.Lib.CompanyTime.Today(CompanyID);
Ice.Lib.CompanyTime.Today(); // CurrentCompany Defaulted
Ice.Lib.CompanyTime.Now(CompanyID);
Ice.Lib.CompanyTime.Now(); // CurrentCompany Defaulted
2 Likes

I’d like to add:
var sitetime = Ice.Lib.TimeZone.GetSiteLocalTime();
Dont forget to import it.

2 Likes

This is probably only relevant from the the fact that TZs are involved, but the Task Agent Schedules can run in their own time zone and if empty then it just uses the TZ of the app server.

This is a true statement, it does rely on Company\Site timezones to be set.

1 Like

Since we’re necroposting… have any of you seen issues with sending in dates (with no time) and the date coming back out with a “Time zone” shifted date?

This BAQ is just taking a date parameter, and spitting it back out as a calculated field.

Even better, V1 doesn’t do the time zone hokey pokey. Kinetic still uses V1 in most of their screens (BAD EPICOR!) so you wouldn’t see this unless you are using the REST V2 api, which we are. And it’s causing stupid annoying problems that we don’t haven’t found a great way to fix.

keanu reeves vampire GIF

Holy moley - so it just decides to shift your input date?

I saw some posts about timezone settings in REST headers yesterday while scouring, I wonder if any of those are relevant. Let me see if I can accidentally find them again.

Here’s one:

Well, that’s the same issue, not resolved. Haha.

1 Like

:rofl:

If you just put the input date param into a calc field (unless thats what you already did), does it shift that too?

That’s what this BAQ is.

Do you guys have TZs set on Comps and Sites?

We do. It doesn’t seem to follow those. It uses the server time zone, not the plant one.

I am all for hacky workarounds, I’ve built my hopes and dreams on them. You could possibly just pass a string and parse that bad boy yourself.

That’s what the second calculated field does. You would have to return a string, and then deal with it on the output as not a date. Which I suppose we could do, but it’s tough to be consistent on that and remember, “It’s a date, but we have to lie to the system and make it a string because the system is trying to be helpful like excel…”

:face_in_clouds:

Out of curiosity, does a function date behave same?

To clarify, it’s on the output that it get’s shifted. The input is fine.

:thinking: That’s a good question. I’m not sure.

Interesting, does the problem affect inside BAQ editor or only when invoked via REST?

Edit: Well i dont guess it would\could

Only when invoked via REST, and only with V2! So not only is it wrong, it’s the worst kind of wrong where it’s inconsistent.

image

A nice podcast episode about why handling time sucks.