Skip to main content
Answer

Date formatter issue - Same timezone output date is previous day

  • August 1, 2024
  • 6 replies
  • 63 views

Adding the log below from the formatter

I am pulling the date from salesforce and formatting it to show the date correctly in a message to the customers. But in some cases, we are seeing the date being changed to the previous day.

-----

 

 

Request Information

Method:

POST

URL/Path:

https://transformer.zapier.com/transform

Expand 2 Headers

Params:

N/A

Duration (milliseconds):

23

Data:

{ "to_timezone": "US/Mountain", "from_timezone": "US/Mountain", "transform": "date.formatting", "inputs": "2024-08-07T00:00:00Z", "to_format": "MMM DD YYYY", "from_format": "YYYY-MM-DDTHH:mm:ssZ" }

Response Information

Status code:

200

Expand 3 Headers

URL/Path:

https://transformer.zapier.com/transform

Content:

{ "outputs": "Aug 06 2024" }

Best answer by Troy Tessalone

Hi @danbbm 

Many systems operate on UTC time.

Check if the timestamp returned from Salesforce is in UTC time.

If so, then the From Time Zone would need to be set to UTC in the Formatter step.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • August 1, 2024

Hi @danbbm 

Many systems operate on UTC time.

Check if the timestamp returned from Salesforce is in UTC time.

If so, then the From Time Zone would need to be set to UTC in the Formatter step.


  • Author
  • Beginner
  • August 1, 2024

Hi @danbbm 

Many systems operate on UTC time.

Check if the timestamp returned from Salesforce is in UTC time.

If so, then the From Time Zone would need to be set to UTC in the Formatter step.

Thanks Troy.

 

What is the best way to confirm if the timestamp is in UTC? Also what if I do not want any conversion done. Just the date to be formatted? That is the reason I set both to MST.


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 1, 2024

@danbbm 

If you just want to take the Timestamp and convert the Date Format then try this

 

2024-08-07T00:00:00Z

 

Action: Formatter > Text > Split

Split at T

Keep the first Segment

That will give you a date as: YYYY-MM-DD

 

Action: Formatter > Date & Time > Format

Specify the desired Date Format: MMM DD YYYY

Use the same Time Zone for To/From

 

If you need more help, for us to have true context, post screenshots with how your Zap steps are outlined and configured in EDIT mode.


  • Author
  • Beginner
  • August 1, 2024

I changed both the from and to timezone to UTC and the date seems to stay the same. Would this work?

 

 

 


  • Author
  • Beginner
  • August 1, 2024

Here are the steps, 

 

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 1, 2024

@danbbm 

Would this work?

When in doubt, test it out.

 

If you just want to take the Timestamp and convert the Date Format then try this

 

2024-08-07T00:00:00Z

 

Action: Formatter > Text > Split

Split at T

Keep the first Segment

That will give you a date as: YYYY-MM-DD

 

Action: Formatter > Date & Time > Format

Specify the desired Date Format: MMM DD YYYY

Use the same Time Zone for To/From