JSON data datetime no timezones

137 views
Skip to first unread message

Brian Orpin

unread,
Apr 1, 2021, 12:57:29 AM4/1/21
to crt.sh
I notice that the JSON data returned does not have a timezone on the Date/time strings

It appears that the entry_timestamp is the Local time but the not_before and not_after are linked to the UTC time the certificate was created.

I note Censys is the same on the web interface.

Is the timezone information held and if so could it be included in the response (please don't use Z)?

r...@sectigo.com

unread,
Apr 6, 2021, 8:56:40 AM4/6/21
to crt.sh
The intention is that all of the timestamps (entry_timestamp, not_before and not_after) are expressed in UTC.

Have you seen any examples where this isn't the case?  If so, please let me know the details.

Brian Orpin

unread,
Apr 6, 2021, 10:44:57 AM4/6/21
to crt.sh
Perhaps I should ask a different question (without any assumptions).

The entry timestamp seems to always be an hour behind the "not_before" time stamp.

Why is that?

r...@sectigo.com

unread,
Apr 6, 2021, 11:36:29 AM4/6/21
to crt.sh
Just a hunch, but does this answer your question...?

https://community.letsencrypt.org/t/why-my-le-cert-notbefore-date-one-hour-before-i-apply-to-issue/60848
"Let’s Encrypt certificates are intentionally backdated by 1 hour."

Brian Orpin

unread,
Apr 6, 2021, 12:38:27 PM4/6/21
to crt.sh
I think that explains it nicely.

For the avoidance of doubt, adding a +00:00 to the timestamp would be nice. Python in particular assumes a timestamp is 'local' if there is no TZ info.

r...@sectigo.com

unread,
Apr 8, 2021, 5:25:36 AM4/8/21
to crt.sh
It returns whatever row_to_json() produces (see https://www.postgresql.org/docs/12/functions-json.html), so I'm not minded to attempt to tweak it.  I suggest that you do whatever you need to do at your end to convince Python that the timestamps are expressed in UTC.
Reply all
Reply to author
Forward
0 new messages