Reputation: 348
Is there a standard or at least generally accepted convention to represent relative dates?
For ex.,
-5d => 5 days ago
5d 4m 3s => 5 days, 4 minutes and 3 secs
where units are y, M, d, h, m, s
Note that I checked on the question but that talks about absolute date ranges but here I'm looking for relative date conventions.
Upvotes: 0
Views: 424
Reputation: 23091
I think you are looking for ISO 8601 Time intervals, specifically Durations.
There are four ways to express a time interval:
- Start and end, such as "2007-03-01T13:00:00Z/2008-05-11T15:30:00Z"
- Start and duration, such as "2007-03-01T13:00:00Z/P1Y2M10DT2H30M"
- Duration and end, such as "P1Y2M10DT2H30M/2008-05-11T15:30:00Z"
- Duration only, such as "P1Y2M10DT2H30M", with additional context information
Upvotes: 1