1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Update documentation to fix a mistake with format used by created and modified (#7060)

This commit is contained in:
Maurycy Zarzycki 2022-11-24 19:43:51 +01:00 committed by GitHub
parent 00927d2e13
commit 2fcbf3b521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ tags: Features
title: DateFormat
type: text/vnd.tiddlywiki
The default representation of dates is a compact string such as `20211002153802059`. For example, the `created` and `modified` fields are stored like this.
The default representation of dates is a compact string such as `20211002153802059`. For example, the `created` and `modified` fields are stored like this.
The display format for this string can be controlled with a template. For example, transcluding the `modified` field automatically applies a template to display the date as `Sat Oct 02 2021 17:40:50 GMT+0200 (Central European Summer Time)`. A few widgets and filter operators allow you to manually specify a template, for example the ViewWidget:
@ -71,10 +71,10 @@ You can calculate the difference between two dates by doing the following:
Here is an example of calculating the number of days that passed between creation and last modification of current tiddler:
* Fields `modified` and `created` contain their respective datetimes in the format `YYYYMMDDHHMMSSmmm` so convert them to timestamps
* Fields `modified` and `created` contain their respective datetimes in the format `[UTC]YYYY0MM0DD0hh0mm0ssXXX` so convert them to timestamps
* `86400000` is the number of milliseconds in a day (1000 * 60 * 60 * 24)
<$macrocall $name=".example" n="0" eg="""<$let
<$macrocall $name=".example" n="0" eg="""<$let
timestamp-modified={{{ [{!!modified}format:date[TIMESTAMP]] }}}
timestamp-created={{{ [{!!created}format:date[TIMESTAMP]] }}}
difference-days={{{ [<timestamp-modified>subtract<timestamp-created>divide[86400000]floor[]] }}}>