APIs & Integrations

CBabb
Member

UNIX Timestamps are inaccurate? Or I'm doing something wrong.

SOLVE

Account default timestamp is UTC -7:00 Los Angeles

 

When I pull a date from HubSpot into Zapier to convert the dates, the timestamp is sometimes off by a day. For example, one of my Deals has the date 02/15/2023.

 

When I pull the date into Zapier, it shows an input of 167419200000.

When I input this UNIX timestamp into this converter,  the date produced is 02/14/2023, which is the same date output I get through Zapier.

 

I notice the converter cuts off three 0's. Is this the issue? Is there somethinge else going on? 

 

It's causing inconsistent issues within HubSpot.

0 Upvotes
1 Accepted solution
Henrik_B_Stein
Solution
Participant | Platinum Partner
Participant | Platinum Partner

UNIX Timestamps are inaccurate? Or I'm doing something wrong.

SOLVE

Hey Cbabb,

If you are experiencing inconsistencies with UNIX timestamps, there may be a time zone mismatch between the timestamp and the converter you are using. It's important to keep in mind that UNIX timestamps are typically calculated as the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC.

If the timestamp you are working with is in UTC-7:00 Los Angeles time zone, you will need to adjust the timestamp to UTC before converting it to a date. This can be done by adding or subtracting the appropriate number of hours from the timestamp, depending on the time zone difference.

To your other question "I notice the converter cuts off three 0's. Is this the issue? Is there somethinge else going on?"

The reason why the converter cuts off three zeros is that it expects the input to be in milliseconds rather than seconds. UNIX timestamps are often represented in milliseconds in some programming languages and systems, so it's possible that the timestamp you're working with is in milliseconds. But I don't think that's the issue here.

I hope this helps you, and please feel free to ask any further questions you may have.

Best regards,

Henrik Bartenstein

View solution in original post

1 Reply 1
Henrik_B_Stein
Solution
Participant | Platinum Partner
Participant | Platinum Partner

UNIX Timestamps are inaccurate? Or I'm doing something wrong.

SOLVE

Hey Cbabb,

If you are experiencing inconsistencies with UNIX timestamps, there may be a time zone mismatch between the timestamp and the converter you are using. It's important to keep in mind that UNIX timestamps are typically calculated as the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC.

If the timestamp you are working with is in UTC-7:00 Los Angeles time zone, you will need to adjust the timestamp to UTC before converting it to a date. This can be done by adding or subtracting the appropriate number of hours from the timestamp, depending on the time zone difference.

To your other question "I notice the converter cuts off three 0's. Is this the issue? Is there somethinge else going on?"

The reason why the converter cuts off three zeros is that it expects the input to be in milliseconds rather than seconds. UNIX timestamps are often represented in milliseconds in some programming languages and systems, so it's possible that the timestamp you're working with is in milliseconds. But I don't think that's the issue here.

I hope this helps you, and please feel free to ask any further questions you may have.

Best regards,

Henrik Bartenstein