0

I am using the REST API for creating a new Task record, including an Activity Date in the format YYYY-MM-DDThh:mm:ssZ. My current timezone is UTC+1.

When submitting a date in the first hour of the day, i.e. for example from 2018-11-19T00:00:00+01:00 to 2018-11-19T00:59:59+01:00, the Activity date is rendered as the previous day on the Task's detail page in my lightning expirience, here 11/18/2018 (Locale: English (United States)). Only when pushing a later date like 2018-11-19T01:00:00+01:00, the Activity Date is correct and shows 11/19/2018.

I then created a custom Date/Time field for the Task and pushed the same dates as above. In that case, every date is rendered correctly, i.e. when pushing 2018-11-19T00:00:00+01:00, it is rendered correctly as 11/19/2018 12:00 AM.

In conclusion, it seems that the Activity Date, which has the field type "Date", is ignoring the timezone, while my custom field, which has the field type "Date/Time", is considering the timezone properly. This behavior applies not only for Tasks, but for every object that has fields of type Date or Date/Time.

Is there something that I missed or is it a bug?

1 Answer 1

1

From https://salesforce.stackexchange.com/a/159543/58595:

DateTime fields store the time information in UTC and display the appropriate date and time to the user based on the user's personal timezone settings.

Date fields contain no time information and completely ignore timezones. Whatever date you specify when you set it will be the date every user sees, with any time and zone information being ignored.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .