0

I have created a custom action that sets a date/time field to "NOW()" when the user hits save.

The user is in PST time zone.

The user hits save, the date/time field is updated to 1:30PM for them.

When I look at that field it says 5:30PM.

This is great....it makes sense and is what we want.

The problem is in the backend, Salesforce is saying the time is 9:30PM because I believe they store everything in UTC.

The problem is need to use this field to pass that date/time value to a 3rd party app and if the user in PST enters it at 4:30PST, we can't have it be entered as the next day in the 3rd party app which is what is happening now because it PST is 8 hours behind UTC.

Any suggestions as to how I can ensure that the proper time is sent? Please note that we are in Canada and will only be dealing with PST through to AST.

2
  • The phrase "Salesforce is saying" implies you (the user) seeing the date/time as rendered by Salesforce for you. Date, Date/Time, and Time values always display in the time zone of the user who is viewing them. Date/Time values are converted to and stored as GMT when a record is saved and then converted again when a user outside of GMT views them. Sending anything to a 3rd party app requires a contract that specifies the format of the data being sent, something your question doesn't talk about. See linked answer for more info.
    – identigral
    Feb 1, 2022 at 18:10
  • Also note that the value is logged (in debug) in UTC ("GMT") and sent in UTC in JSON for REST.
    – Phil W
    Feb 1, 2022 at 19:35

0

Browse other questions tagged .