mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Missing docs for working with negative years
This commit is contained in:
parent
b63049b4df
commit
13b69a9c10
29
editions/tw5.com/tiddlers/concepts/Date Fields.tid
Normal file
29
editions/tw5.com/tiddlers/concepts/Date Fields.tid
Normal file
@ -0,0 +1,29 @@
|
||||
created: 20150117190213631
|
||||
modified: 20201201154211507
|
||||
tags: Concepts
|
||||
title: Date Fields
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Certain [[fields|TiddlerFields]] of a tiddler are used to store dates and times. TiddlyWiki supports dates from the year -9999 to the year 9999.
|
||||
|
||||
The two standard date fields are <<.field created>> and <<.field modified>>.
|
||||
|
||||
Values of date fields are 17 or 18-character strings:
|
||||
|
||||
* <<.from-version "5.1.23">> an optional minus sign `-` to indicate a negative year
|
||||
* 4 digits for the year
|
||||
* 2 digits for the month
|
||||
* 2 digits for the day
|
||||
* 2 digits for the hour
|
||||
* 2 digits for the minute
|
||||
* 2 digits for the second
|
||||
* 3 digits for the millisecond
|
||||
|
||||
To avoid problems arising from differences of time zone, TiddlyWiki always uses [[UTC|https://en.wikipedia.org/wiki/Coordinated_Universal_Time]].
|
||||
|
||||
As an example, the <<.field created>> field of this tiddler has the value <<.value """<$view field="created"/>""">>.
|
||||
|
||||
Dates can be [[converted to other formats|DateFormat]] for display:
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="""<$view field="created" format="date" template="DDD DDth MMM YYYY"/>""">
|
52
editions/tw5.com/tiddlers/features/DateFormat.tid
Normal file
52
editions/tw5.com/tiddlers/features/DateFormat.tid
Normal file
@ -0,0 +1,52 @@
|
||||
created: 20140418142957325
|
||||
modified: 20201201154521138
|
||||
tags: Features
|
||||
title: DateFormat
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
When used to display date values (with the `format` attribute set to ''date''), the ViewWidget accepts a `template` attribute that allows the format of the date values to be specified. The format string is processed with the following substitutions:
|
||||
|
||||
|!Token |!Substituted Value |
|
||||
|`DDD` |Day of week in full (eg, "Monday") |
|
||||
|`ddd` |Short day of week (eg, "Mon") |
|
||||
|`DD` |Day of month |
|
||||
|`0DD` |Adds a leading zero |
|
||||
|`DDth` |Adds a suffix |
|
||||
|`WW` |ISO-8601 week number of year |
|
||||
|`0WW` |Adds a leading zero |
|
||||
|`MMM` |Month in full (eg, "July") |
|
||||
|`mmm` |Short month (eg, "Jul") |
|
||||
|`MM` |Month number |
|
||||
|`0MM` |Adds leading zero |
|
||||
|`YYYY` |Full year |
|
||||
|`YY` |Two digit year |
|
||||
|`wYYYY` |Full year with respect to week number |
|
||||
|`aYYYY` |<<.from-version "5.1.23">> Full year but negative dates are displayed as positive |
|
||||
|`wYY` |Two digit year with respect to week number |
|
||||
|`{era:BCE||CE}` |<<.from-version "5.1.23">> Displays a different string for years that are negative, zero or positive (see below) |
|
||||
|`hh` |Hours |
|
||||
|`0hh` |Adds a leading zero |
|
||||
|`hh12` |Hours in 12 hour clock |
|
||||
|`0hh12` |Hours in 12 hour clock with leading zero |
|
||||
|`mm` |Minutes |
|
||||
|`0mm` |Minutes with leading zero |
|
||||
|`ss` |Seconds |
|
||||
|`0ss` |Seconds with leading zero |
|
||||
|`XXX` |Milliseconds |
|
||||
|`0XXX` |Milliseconds with leading zero |
|
||||
|`am` or `pm` |Lower case AM/PM indicator |
|
||||
|`AM` or `PM` |Upper case AM/PM indicator |
|
||||
|`TZD` |Timezone offset |
|
||||
|`\x` |Used to escape a character that would otherwise have special meaning |
|
||||
|`[UTC]`|Time-shift the represented date to UTC. Must be at very start of format string|
|
||||
|
||||
Note that other text is passed through unchanged, allowing commas, colons or other separators to be used.
|
||||
|
||||
The `{era:BCE||CE}` notation can specify different strings for years that are negative, zero or positive. For example `{era:BC|Z|AD}` would display `BC` for negative years, `AD` for positive years, and `Z` for year zero.
|
||||
|
||||
! Examples
|
||||
|
||||
|!Template |!Output |
|
||||
|`DDth MMM YYYY` |16th February 2011 |
|
||||
|`DDth MMM \M\M\M YYYY` |16th February MMM 2011 |
|
||||
|`DDth mmm YYYY 0hh:0mm:0ss` |16th Feb 2011 11:38:42 |
|
Loading…
Reference in New Issue
Block a user