Webtags/Parameters: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
No change in size ,  10:00, 3 October 2022
m
no edit summary
mNo edit summary
Line 185: Line 185:


Best method probably is to migrate and look at your website or reports - wherever you use your Webtags - and check your date/time formats. Then modify where you think it is required.
Best method probably is to migrate and look at your website or reports - wherever you use your Webtags - and check your date/time formats. Then modify where you think it is required.
====Time formats====
Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table.  As explained earlier, time formats can be used with both time-duration reporting and clock time reporting.
In some rows of this table, square brackets [] indicate optional items, they are included just to make it clearer how items can be combined in a single output parameter.  If you want to include what is shown in square brackets you don't type the square brackets e.g. <tt><#LastDataReadT format="h:nn am/pm"></tt>
{| class="wikitable" border="1"
|-
!style="width:150px" | Mono/.NET Specifier for Cumulus MX
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|%h
|Displays the hour (12 hour clock) without a leading zero (1-12)
| 7
|-
|%h ''tt''
|Displays the hour (12 hour clock) without a leading zero (1-12)  in combination with AM/PM.
What "tt" produces depends on locale settings for your device, it might be capitals or it might be lower case (in Windows use Control Panel, not Settings app, to get to these regional additional settings).
| 7 PM
|-
|%h:mm [''tt'']
|Displays the hour (using 12 hour clock) without a leading zero (1-12) followed by 2 digit minutes [optionally in combination with AM/PM whose case varies as explained in previous entry].
|'10:27 am' produced by <#LastDataReadT format="h:mm tt">
|-
|%H
| Displays the hour part of any duration or clock time, without a leading zero (0-23).
Note that '%' before the "H", this makes it a custom modifier, needed because H is on its own.
|7 produced by
<#daylength format=%H>
|-
| H:mm
| Displays the hour part of any duration or clock time, without a leading zero (0-23) followed by 2 digit minutes for that duration or clock time.
|'6:27' or '17:49' produced by <#LastDataReadT format="H:mm">
|-
|HH
| Displays the hour part of any duration or clock time, using 24 hour clock with a leading zero (00-23).
|'06' or '17' produced by <#LastDataReadT format=HH>
|-
|hh [''tt'']
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) [optionally, if it is a clock time, in combination with am/pm].
The optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon but before midnight.
|'07 am' produced by
<#LastDataReadT format="hh tt"> if locale specifies lower case
|-
|hh:mm [''tt'']
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) followed by 2 digit minutes [optionally, if it is a clock time, in combination with am/pm].
The optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight
|'8:27 am' produced by
<#LastDataReadT format="h:mm tt"> if locale specifies lower case
|-
|%m
|Displays the minutes of any duration or clock time, without a leading zero (0-59).
As other examples show, the % is only needed when "m" is on its own.
| 7 produced as a duration in minutes by
<#daylength format=m>
|-
|mm
|Displays the minutes of any duration or clock time, with a leading zero (00-59).
|'07' produced as a duration in minutes by
<#daylength format=mm>
|-
|%s
|Displays the seconds for any duration or clock time, that has resolution to less than a minute, without a leading zero (0-59).
| 9 produced by <#metdate format=%s>
|-
|ss
|Displays the second with a leading zero (00-59).
|'06' or 19 produced by <#LastDataReadT format=ss>
|-
|FFF
|Displays the millisecond without a leading zero. Displays either nothing or displays 1-999. So don't write any code that assumes the MX output is numeric.
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Microsoft Windows.
|
|-
|ff (or ''f'')
|Displays hundredths of a second (or tenths) with leading zero(s)
|
|-
|fff
|Displays the millisecond with a leading zero (000-999).
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Microsoft Windows.
The 'fff' modifier can actually be extended to 'ffffff' for output to a millionth of a second!
| 09:47:25.000' produced by
<#time format=hh:mm:ss.fff>
|-
| zzz
|Displays the offset of any time from UTC in hours and minutes 
| e.g.-07:00
|-
|"h:mm K"
|Effectively another way of including time zone after a time, but it can only be used for time-zones never matching UTC (if understood correctly)
|(no examples supplied yet)
|-
|%t
|Displays the time using the Short Time format.
Remember that 't' combined with other specifiers (or preceded by space or '%') has a different meaning - see below.
| '09:47' produced by <#LastDataReadT format=t> (might not use colon in your locale)
|-
|tt
|'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight, so whether it displays in capitals or lower case is determined by the locale settings, not the case of "tt".
|
|-
|h t
|Uses the 12-hour clock for the preceding h or H (clock time) specifier, and displays 'a' for any hour from midnight until before noon, and 'p' for noon or any hour after noon.
whether it displays the "a" or "p" in capitals or lower case is determined by the locale settings, not the case of "t".
| see previous example
|-
|/
|Displays the date separator character given by the Date Separator. It might not display a slash.
| '/' for typical British locale
|-
|:
|Displays the time separator character given by the Time Separator, this might not display a colon.
Note that by default Cumulus MX expects a locale to use ":" for any time separator.
|':' for British locale
|}
====Year formats====
These are the simplest output format modifiers.  We can only choose from 2 options, and because both involve more than one character their context does not matter.  Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options that are mandatory for MX:
{| class="wikitable" border="1"
|-
!style="width:150px" | Specifier
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|yy
|Displays the year as a two-digit number (00-99).
|19 produced by <#LastDataReadT format=yy>
|-
|yyyy
|Displays the year as a four-digit number (2000-9999).
|2009 produced by <#LastDataReadT format=yyyy>
|}


====Month formats====
====Month formats====
Line 478: Line 332:
* [[File:Badge v1.png]]<#LastDataReadT format=TT>  
* [[File:Badge v1.png]]<#LastDataReadT format=TT>  
*[[File:Badge vMx.png]]<#LastDataReadT format=T>
*[[File:Badge vMx.png]]<#LastDataReadT format=T>
|}
====Time formats====
Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table.  As explained earlier, time formats can be used with both time-duration reporting and clock time reporting.
In some rows of this table, square brackets [] indicate optional items, they are included just to make it clearer how items can be combined in a single output parameter.  If you want to include what is shown in square brackets you don't type the square brackets e.g. <tt><#LastDataReadT format="h:nn am/pm"></tt>
{| class="wikitable" border="1"
|-
!style="width:150px" | Mono/.NET Specifier for Cumulus MX
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|%h
|Displays the hour (12 hour clock) without a leading zero (1-12)
| 7
|-
|%h ''tt''
|Displays the hour (12 hour clock) without a leading zero (1-12)  in combination with AM/PM.
What "tt" produces depends on locale settings for your device, it might be capitals or it might be lower case (in Windows use Control Panel, not Settings app, to get to these regional additional settings).
| 7 PM
|-
|%h:mm [''tt'']
|Displays the hour (using 12 hour clock) without a leading zero (1-12) followed by 2 digit minutes [optionally in combination with AM/PM whose case varies as explained in previous entry].
|'10:27 am' produced by <#LastDataReadT format="h:mm tt">
|-
|%H
| Displays the hour part of any duration or clock time, without a leading zero (0-23).
Note that '%' before the "H", this makes it a custom modifier, needed because H is on its own.
|7 produced by
<#daylength format=%H>
|-
| H:mm
| Displays the hour part of any duration or clock time, without a leading zero (0-23) followed by 2 digit minutes for that duration or clock time.
|'6:27' or '17:49' produced by <#LastDataReadT format="H:mm">
|-
|HH
| Displays the hour part of any duration or clock time, using 24 hour clock with a leading zero (00-23).
|'06' or '17' produced by <#LastDataReadT format=HH>
|-
|hh [''tt'']
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) [optionally, if it is a clock time, in combination with am/pm].
The optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon but before midnight.
|'07 am' produced by
<#LastDataReadT format="hh tt"> if locale specifies lower case
|-
|hh:mm [''tt'']
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) followed by 2 digit minutes [optionally, if it is a clock time, in combination with am/pm].
The optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight
|'8:27 am' produced by
<#LastDataReadT format="h:mm tt"> if locale specifies lower case
|-
|%m
|Displays the minutes of any duration or clock time, without a leading zero (0-59).
As other examples show, the % is only needed when "m" is on its own.
| 7 produced as a duration in minutes by
<#daylength format=m>
|-
|mm
|Displays the minutes of any duration or clock time, with a leading zero (00-59).
|'07' produced as a duration in minutes by
<#daylength format=mm>
|-
|%s
|Displays the seconds for any duration or clock time, that has resolution to less than a minute, without a leading zero (0-59).
| 9 produced by <#metdate format=%s>
|-
|ss
|Displays the second with a leading zero (00-59).
|'06' or 19 produced by <#LastDataReadT format=ss>
|-
|FFF
|Displays the millisecond without a leading zero. Displays either nothing or displays 1-999. So don't write any code that assumes the MX output is numeric.
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Microsoft Windows.
|
|-
|ff (or ''f'')
|Displays hundredths of a second (or tenths) with leading zero(s)
|
|-
|fff
|Displays the millisecond with a leading zero (000-999).
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Microsoft Windows.
The 'fff' modifier can actually be extended to 'ffffff' for output to a millionth of a second!
| 09:47:25.000' produced by
<#time format=hh:mm:ss.fff>
|-
| zzz
|Displays the offset of any time from UTC in hours and minutes 
| e.g.-07:00
|-
|"h:mm K"
|Effectively another way of including time zone after a time, but it can only be used for time-zones never matching UTC (if understood correctly)
|(no examples supplied yet)
|-
|%t
|Displays the time using the Short Time format.
Remember that 't' combined with other specifiers (or preceded by space or '%') has a different meaning - see below.
| '09:47' produced by <#LastDataReadT format=t> (might not use colon in your locale)
|-
|tt
|'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight, so whether it displays in capitals or lower case is determined by the locale settings, not the case of "tt".
|
|-
|h t
|Uses the 12-hour clock for the preceding h or H (clock time) specifier, and displays 'a' for any hour from midnight until before noon, and 'p' for noon or any hour after noon.
whether it displays the "a" or "p" in capitals or lower case is determined by the locale settings, not the case of "t".
| see previous example
|-
|/
|Displays the date separator character given by the Date Separator. It might not display a slash.
| '/' for typical British locale
|-
|:
|Displays the time separator character given by the Time Separator, this might not display a colon.
Note that by default Cumulus MX expects a locale to use ":" for any time separator.
|':' for British locale
|}
====Year formats====
These are the simplest output format modifiers.  We can only choose from 2 options, and because both involve more than one character their context does not matter.  Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options that are mandatory for MX:
{| class="wikitable" border="1"
|-
!style="width:150px" | Specifier
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|yy
|Displays the year as a two-digit number (00-99).
|19 produced by <#LastDataReadT format=yy>
|-
|yyyy
|Displays the year as a four-digit number (2000-9999).
|2009 produced by <#LastDataReadT format=yyyy>
|}
|}


Navigation menu