tjbroekman at January 11th, 2022 06:58 — #1
I am retrieving company data from the api. I am interested in when the company is last modified. Luckely there's a field for that. However, it displays the wrong timezone. My account is set to Amsterdam (+01:00), but the api outputs in (00:00). I have checked and the api credentials of my account are used for the API calls.
Did I miss something?
Thanks in advance.
tjbroekman at January 11th, 2022 07:33 — #2
If I convert the timestamp with strtotime(), and convert that back with date(), I get the correct time.
I really cannot figure why.
dd( $company->company->modified_at, date( "l jS \of F Y h:i:s A", strtotime($company->company->modified_at )));
"Tuesday 11th of January 2022 12:39:17 PM"
victor at January 12th, 2022 13:03 — #3
Hi @TJBroekman! Thanks for your question!
The date value
created_at) is a UTC time. To get the value in a specific timezone, you need to apply the timezone offset to it.
# => Fri, 08 Mar 2019 18:24:35 +0000
# => Fri, 08 Mar 2019 19:24:35 CET +01:00
To get the user timezone, make GET
https://app.onepagecrm.com/api/v3/bootstrap request and find
time_zone field in
tjbroekman at January 13th, 2022 05:43 — #4
Thankyou for the clear explanation Victor.
alexsunny123 at March 18th, 2022 05:55 — #5
thanks for the awesome information.