Timestamps are a critical part of Timekit.

All timestamps in Timekit are RFC3339 / ISO 8601
/ ATOM formatted. This is the default input and output format.


Below are examples of how you generate a RFC 3339 formatted timestamp string:

// Built-in with output in Zulu/UTC timezone:
// e.g. 2019-11-24T08:46:01Z

const date = new Date();
const isoDate = date.toISOString().split('.')[0]+'Z';

// Using moment.js with timezone offset:
// e.g. 2019-11-24T08:46:01+01:00

const moment = require('moment');
const date = new Date();
const isoDateOffset = moment(date).format();
require 'time'
now = Time.now
isoDate = now.rfc3339
$now = new DateTime();
$isoDate = $now->format(DateTime::RFC3339);
String isoDate = ZonedDateTime.now().format( DateTimeFormatter.ISO_INSTANT );
DateTime localTime = DateTime.Now;
DateTimeOffset localTimeWithOffset = new DateTimeOffset(localTime, TimeZoneInfo.Local.GetUtcOffset(localTime));
String isoDate = localTimeWithOffset.ToString("yyyy-MM-ddTHH:mm:ssK")
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];   
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];

NSDate *now = [NSDate date];
NSString *isoDate = [dateFormatter stringFromDate:now];
let dateFormatter = DateFormatter()
let enUSPosixLocale = Locale(identifier: "en_US_POSIX")
dateFormatter.locale = enUSPosixLocale
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"

let isoDate = dateFormatter.string(from: Date())
import datetime
now := time.Now()
isoDate := now.Format(time.RFC3339)