Skip to main content

I have created a Generic Inquiry that will show the Date and Time that a Sales Order was printed.

I am using the SOOrderShipment.CreatedDateTime field and the following code to extract the time.

=IIF(HOUR((SOOrderShipment.CreatedDateTime])<=12,PADLEFT(CSTR(HOUR((SOOrderShipment.CreatedDateTime])),2,'0')+':'+PADLEFT(CSTR(MINUTE((SOOrderShipment.CreatedDateTime])),2,'0')+ ' AM',PADLEFT(CSTR(HOUR((SOOrderShipment.CreatedDateTime])-12),2,'0')+':'+PADLEFT(CSTR(MINUTE((SOOrderShipment.CreatedDateTime])),2,'0')+ ' PM')

This works as it should other than it displays the Time as UTC time. I need it to display the time for our region. We are in the US Eastern time zone (-5 hours). 

Thank you for any assistance.

 

Hi @Del! It is Microsoft standard to store all date/time fields in UTC time, it is only when the field is viewed in the UI that the user profile time zone is applied to the date seen.

The issue is that when you use a date time field in an expression, it will always pull the time stored in SQL and not apply the UI time zone, so you would need to apply a -5 to the hours, but if someone is in a time zone of -4 or -6, then they will still see the -5 hrs EST time.


BenjaminCrisman

Thank you for the quick response. I understand that the time is stored as UTC, and am trying to find a way to convert the UTC time to our local time while using the code that extracts the time for the CreatedDateTime field.

Also all our users are located in the US Eastern Time Zone.  


I’ve historically used the dateadd formula with the interval of ‘h’ (hours) and add of -5 (from UTC to ET).

 

It would look something like this: =dateadd(aSOOrderShipment.CreatedDateTime], ‘h’, -5).


@Del I was just typing the option which @kdavis45 suggested, this should work as needed for this.

Also though, you could try just adding -5 to the Hour() function part, seems like it should pick that up correctly.


Reply