Skip to main content

I need to display on a custom GI the start and end log TIME
(from the Appointment screen FS300200).

As date-time fields are stored in UTC format.
Therefore I use the next well known approach to calculate hour’s part into local time zone:

Hour (
DateAdd (
FSLog.DateTimeBegin],
'h',
DateDiff (
'h',
NowUTC(),
Now()
)
)
)

 

But, the problem.

How to manage winter/summer saving time periods?

The customer is from Singapore, and Singapore doesn't have saving time period.
With this Now/NowUTC approach for records from winter period a time is provided with one extra hour.

Hi @olexandrProkopovych94 

Not sure if this may help or not, but what is in the Daylight Savings Settings in Acumatica? Is something manually configured?

 

 


@kbeatty21 , no, this is not the issue for this case.

But your advice helped me to solve another similar issue.
We tested GIs on different servers, and different sites had different time settings.
But we did not pay enough attention to this.


@olexandrProkopovych94

If I understand your problem, you’d like the time to be one hour different depending upon which month(s) the date falls in.

You could check the month of the current day and add (or subtract) one hour based on what month it falls in.

For instance: 

Hour(
IIf(
Month(tdateField])>10 Or Month(tdateField])<3,
DateAdd(ddateTimeBegin],'h',DateDiff('h',NowUTC(),Now())),
DateAdd(ddateTimeBegin],'h',DateDiff('h',NowUTC()+1,Now()))
)
)

The IF statement will check if the month number is greater or less than a certain amount and perform a different calculation depending upon that.


@kbeatty21 , no, this is not the issue for this case.

But your advice helped me to solve another similar issue.
We tested GIs on different servers, and different sites had different time settings.
But we did not pay enough attention to this.

With regards to your different times on different sites, have you checked the Site Preferences? The Login Time Zone drives that:

 


With regards to your different times on different sites, have you checked the Site Preferences?

Yes, this was the point. But not of the instance itself – of instance server.


What the lessons I’ve learned with this case.
Under server I’ll mean server or local PC where the instance is installed for developing or testing.

  1. Now() and NowUTC() functions utilize time of instance’s server, wherever it stands.
  2. Check time and time settings of your server. As well of your PC, if you access server remotely.
  3. GMT shifts may have same hours shift but different settings. E. g. the same GMT+X time zones may have different parameters for daylight savings time. Also, time zones settings may differ between different application (e.g. Acumatica and server’s OS). Might be surprises.
  4. Check time settings for the site and your user.
  5. Acumatica stores date/time fields in UTC. But may show converted to time zone of the server.
  6. When you enter in GI only the field (like iCRActivity.StartDate]) Acumatica will display it value converted to server time zone. But if you use the field in calculations, right, Acumatica use the value as it was stored (i.e. in UTC).
  7. Gratitude to @hkabiri for a trick how to display date/time as stored in DB. I mean expression =CDate(sCRActivity.StartDate]).

 

Final advice. When you work with time and correct time is essential, use at least two columns “as is” (i.e. just CRActivity.StartDate]) and “as stored” (i.e. =CDate(tCRActivity.StartDate]) ). If you catch a doubt, you can compare values. After testing you may delete (or better de-activate) “as stored“ column.


@olexandrProkopovych94 

Thank you for the update!


Reply