date format chart/examples, view widget date format macro

47 views
Skip to first unread message

A Gloom

unread,
Nov 11, 2019, 11:23:18 PM11/11/19
to TiddlyWiki
ViewWidget date format display:

updating an idea/chart originally by Stephan Hradek 2014, updated 10/2019 using the current official format list for date format options

Uses a macro based on, demonstrating the default view widget with date format template. Could easily be expanded to read variables or incorporate other features.

\define datedisp(datefield,dateformat)
<$view field='$datefield$' format="date" template="$dateformat$"/>
\end

1st value– field to be read, if its not the created or modified fields, I assume it must be formatted in the standard TW format (see chart below) 2nd value– format desired (see chart below), must be in " " marks if you use multiple values or separator characters or spaces

<<datedisp ddd>> <<datedisp "hh12:mm:am DD-MM-YYYY">>
as opposed to now macro which takes the current time that the macro is involed or refreshed:
<<now ddd>> - <<now "hh12:mm:am DD-MM-YYYY">>

CREATED: Fri - 1:20:am 8-11-2019
MODIFIED: Sat - 5:26:pm 9-11-2019
NOW macro: Mon - 11:12:pm 11-11-2019

created and modified time-stamp fields UTC time-stamp format: [UTC]YYYY0MM0DD0hh0mm0ssXXX
this tiddler's created date for use in examples below: 1:20:am 8/11/2019

*(section of the chart)

Token    displays as    Substituted Value
DDD    Friday    Day of week in full
ddd    Fri    Short day of week
DD    8    Day of month
0DD    08    Adds a leading zero
DDth    8th    Adds a suffix
date format chart.tid
Reply all
Reply to author
Forward
0 new messages