Activity Streams/Primer/Timestamps
< Activity Streams | Primer
Activity Streams 2.0 has several properties that have datetime values:
- published
- updated
- deleted
- startTime
- endTime
The rules for publishing datetime values are given in the Dates and Times section of the AS2 Core specification.
The core format for datetime values in AS2 is:
YYYY-mm-DDTHH:MM:SSZ
Here:
- YYYY represents the 4-digit year
- mm is the 2-digit zero-prefixed month number from 01 to 12
- DD is the 2-digit zero-prefixed day number, from 01 to 31
- T is a constant separator
- HH is the 2-digit zero-prefixed 24-hour time, from 00 to 23
- MM is the 2-digit zero-prefixed minute, from 00 to 59
- SS is the 2-digit zero-prefixed second, from 00 to 59
- Z is a constant terminator, representing the UTC time zone
There are several possible variations, including leaving out the seconds; adding a fractional second part; and using a time offset instead of the Z terminator for supporting local times.
There is no mechanism in this format to define a datetime "in your timezone", such as "2PM on December 25 in your timezone". This is sometimes called "floating time".
Recommendations for publishers
- Use the primary format for timezones, including the seconds, without the fractional seconds, and with the Z terminator for UTC time.
Recommendations for consumers
- Accept the specified variations for timestamps. Using the full ISO 8601 time parsing library for your programming language can make this significantly easier.