Skip to content
Menu
SilktideDevelopers

Dates and times

Times are Unix timestamps in seconds. Days in results are read in a time zone you choose.

View as Markdown

Every time the API sends or accepts, such as when a website was created or last tested, is a Unix timestamp: whole seconds since 00:00:00 UTC on January 1, 1970. 0 means "never", as in a lastTested of 0 for a website that has not been tested yet.

const lastTested = new Date(website.lastTested * 1000);
from datetime import datetime, timezone
last_tested = datetime.fromtimestamp(website["lastTested"], tz=timezone.utc)
$lastTested = (new DateTimeImmutable())->setTimestamp($website['lastTested']);

Results that cover days, such as a score's trend, read those days in the time zone you pass as timezone, an IANA name such as Europe/London. It defaults to UTC. See Results.

The one exception is an Analytics series, such as visitors over time. It writes the time each step starts as YYYY-MM-DD HH:MM:SS, in that timezone.