User:Jc3s5h/Reverse engineer date-time precision

From Wikidata
Jump to navigation Jump to search
The mediawikiwiki:Wikibase/DataModel/JSON#timedata model states the date-time datatype has a year field that is always signed and has between 4 and 16 digits.

So a full date-time example that has all possible digits (even though many of them are not implemented is

+1234567890123456-01-01T01:02:03Z

Note the time zone is currently unsupported but the data model calls for it to be stored in a separate field, so the Z at the end is meaningless

Numbering the digits, with blank colummns inserted for readability:

Example   +1234 56789 01234 56-01 -01T0 1:02: 03Z
          -----|-----|-----|-----|-----|-----|---
digit     00000|00000|11111|11111|22222|33333|444
numbers   01234|56789|01234|56789|01234|56789|123
          -----|-----|-----|-----|-----|-----|---
precision                       1|  1  | 1  1| 1
                  012|34567|89  0|  1  | 2  3| 4