Date formats
Our API is build around the idea that the client should control the response as much as possible. So when you make requests, you can decide the date format that will be returned, like so:
Input and output date formats are set in the header or in a query params.
To choose output format use: OutputTimestampFormat
To choose input format use: InputTimestampFormat
Default format: ISO_8601 eg. 2016-05-26T15:30:00+00:00
If you're passing a timestamp as a GET parameter in a URL, the + sign needs to be URL safe encoded. Replace it with: %2B
Output timestamps date in a custom format
Add a header: 'OutputTimestampFormat: Y-m-d h:ia' or as a query param: ?OutputTimestampFormat=Y-m-d h:ia
curl --request POST \
--url https://api.timekit.io/v2/findtime \
--header 'Content-Type: application/json' \
--header 'OutputTimestampFormat: Y-m-d h:ia' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"emails": [
"[email protected]",
"[email protected]"
],
"future": "2 days",
"length": "30 minutes",
"format": "Y-m-d h:ia"
}'
This will return:
{
"data": [
{
"end": "2015-04-24 09:30am",
"start": "2015-04-24 09:00am"
},
{
"end": "2015-04-24 12:15pm",
"start": "2015-04-24 11:45am"
},
{
"end": "2015-04-24 06:15pm",
"start": "2015-04-24 05:45pm"
},
{
"end": "2015-04-24 08:15pm",
"start": "2015-04-24 07:45pm"
},
{
"end": "2015-04-25 08:00am",
"start": "2015-04-25 07:30am"
}
]
}
The data format is defined in the format params, where the following options is available:
Format | Description | Example |
---|---|---|
d | Day of the month, 2 digits with leading zeros | 01 to 31 |
l | (lowercase 'L') A full textual representation of the day of the week | Sunday through Saturday |
m | Numeric representation of a month, with leading zeros | 01 through 12 |
Y | A full numeric representation of a year, 4 digits | Examples: 1999 or 2003 |
a | Lowercase Ante meridiem and Post meridiem | am or pm |
h | 12-hour format of an hour with leading zeros | 01 through 12 |
H | 24-hour format of an hour with leading zeros | 00 through 23 |
i | Minutes with leading zeros | 00 through 59 |
s | Seconds, with leading zeros | 00 through 59 |
Y-m-d\TH:i:sO | ISO 8601 date | 2004-02-26T15:19:21+00:00 |
U | Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) | 1429866000 |
Timezones
Every timestamp on Timekit is saved in UTC by default.
Timezones are written and formatted using the Country/City convention, like America/Los_Angeles
Each resource has a timezone and it can be retrieved by calling the /resources/me endpoint:
{
"data": {
"activated": true,
"email": "[email protected]",
"first_name": "Dr. Emmett",
"img": "http://www.gravatar.com/avatar/7a613e5348d63476276935025",
"last_name": "Brown",
"last_sync": null,
"name": "Dr. Emmett Brown",
"timezone": "America/Los_Angeles",
"token": "nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW",
"token_generated_at": null
}
}