Webtags/Parameters (preserving history): Difference between revisions

m
Corrections
m (Make legacy/MX differences clearer by identifying MX specific items)
m (Corrections)
=Introduction=
 
Put simply, a [[Webtags|Cumulus tag]] is included to indicate where Cumulus should insert values when it [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processes the command/file]] that quotes the tags.
This page is about parameters used for modifying Cumulus web tags. All this information was originally on [[Webtags]] page, but has been moved to this separate page as part of an attempt to make the Wiki easier to read by shortening pages.
 
The general format for every Cumulus tag is: <code><#tag_name [optional input selection parameters] [optional output modification parameters]></code>
A [[Cumulus template file|'''Cumulus Template File''']] was the name given by Steve Loft to any files that contain web tags. Each of those files need to be processed before they actually include values:
* For Cumulus MX, there is only one Cumulus template file, the web tags that supply values to the various tables in the [[New Default Web Site Information|Default Web Site]] are stored in [[websitedataT.json]] template file.
* Otherwise MX avoids using template files that can be edited, instead the code itself internally generates most of the data files that are sent externally.
* The legacy Cumulus 1 software, and MX releases up to release 3.9.7 - build 3107, used lots of template files (see [[Customised templates]].
 
This page is about those (generally optional) parameters used for modifying Cumulus tags.
[[File:Badge vMx.png]]Cumulus MX also differs from the legacy software in that tag names, with the parameters described on this page, ''can be used in several new places'' including within [[Cumulus_MX_Local_API|Cumulus MX Local API]], [[Cumulus.ini#Optional_Structured_Query_Language_Settings|"My SQL Connector"]], and [[Cumulus.ini_(MX_3.0.0_to_3.7.0)#MQTT|MQTT]]. Most of those web tags use the default output format, but a few use some of the [[#Output modification parameters]] listed below. To customise the default web site, you might want to edit '''websitedataT.json''', by using information found on this page.
 
# An input parameter is used where the same tag name can represent a value for a number of different past time instants.
To set context, let us learn the terminology with cross-references to where those features are explained further.
#* Each of those past time instants is represented by a different value for the input parameter.
#* So a combination of a tag name and input modification parameter lets Cumulus select the value you want to see.
#* Whether a particular tag name can use input modification parameters will depend on both which tag name has been chosen, and which Cumulus release you are using.
# An output parameter is used when a particular tag name can be fed through a process that alters how the output is shown
#* Tag names representing integer values cannot have their output format modified
#* Internally Cumulus handles numbers in binary, for numbers that have an integer and a decimal part, there is no exact conversion between the way the decimal part of a number is stored in binary, and the way the decimal part (after the decimal comma/point) appears on output. Therefore, non-integer numbers have to be rounded, and there are some output parameters that modify the output:
#*# You can modify the number of decimal places shown for some tag names
#*# With Cumulus MX, you can modify whether number is output with a decimal comma, or a decimal point
#* Tag names representing time intervals, clock times, [[meterological day|dates]] or representing both time/date for an extreme record, may have a fixed format that cannot be changed, or may be able to be processed through a date-time routine that changes how either time or date or both are output
 
==What is a web tag? ==
 
All this parameter information was originally on [[Webtags]] page, but has been moved to this separate page as part of an attempt to make the Wiki easier to read by shortening pages.
Put simply, a [[Webtags|web tag]] is included in a [[Cumulus template file]] to indicate where Cumulus should insert values when it [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processes that template]] and produces an output file.
 
The output file can be:
* a [[Customised_templates#HTML_5_-_a_very_quick_guide_to_structure|web page]],
* a [[Php_webtags#Option_3:_JavaScript_Object_Notation|JavaScript Object Notation (.json) file]]
* a [[Feels_Like#HTML_code_to_translate_web_tags_to_JavaScript_variables_.28as_modified_for_additional_parameters.29|JavaScript file]],
* a [[PHP]] script file, or
* a [[Xml_webtags|eXtensible Mark-up Language (XML)]] file.
 
=Legacy software=
==General Format for Web Tags==
 
The legacy Cumulus 1 software can only use tag names, and whatever parameters are permitted, within a file. Steve Loft used [[Cumulus template file|'''Cumulus Template File''']] for a file that used tags:
In the position in the template file where Cumulus is to insert the relevant data, place a web tag in the '''general format''' specified here:
* The legacy Cumulus 1 software, and MX releases up to release 3.9.7 - build 3107, provided a selection of template files (see [[Customised templates]] that produced 'standard' web pages, see [[Cumulus.ini_(Cumulus_1)#Section:_FTP_site|"IncludeSTD" here]].
* A Cumulus user could specify an alternative [[Customised_templates#HTML_5_-_a_very_quick_guide_to_structure|web page]],
* A Cumulus user could transfer data to a web server using a [[Php_webtags#Option_3:_JavaScript_Object_Notation|JavaScript Object Notation (.json) file]]
* A Cumulus user could transfer data to a web server using a [[Feels_Like#HTML_code_to_translate_web_tags_to_JavaScript_variables_.28as_modified_for_additional_parameters.29|JavaScript file]],
* A Cumulus user could transfer data to a web server using a [[PHP]] script file, or
* A Cumulus user could transfer data to a web server using a [[Xml_webtags|eXtensible Mark-up Language (XML)]] file.
 
For information on how to process, and upload, non-standard files, see [[Cumulus.ini_(Cumulus_1)#Section:_FTP_site|"ExtraProcessxx"]].
<code><#tag_name [optional input selection parameters] [optional output modification parameters]></code>
 
==== Case sensitivity for tag names ====
 
=Cumulus MX software=
The tag_name in the general format above is case sensitive, so please type the tag name exactly as shown in the tag name columns in the tables on the [[Webtags|tag names page]].
 
MX can process template files, using [[Cumulus.ini#Extra_Web_Files|Extra web file settings]], but tag names (and input/output parameters as permitted) can also be used in:
== What is a web tag parameter?==
* standard [[websitedataT.json]] template file, or a tailored file that is processed into same destination file
* on demand using [[Cumulus_MX_Local_API|Cumulus MX Local API]]
* standard or custom interval use of [[Cumulus.ini#Optional_Structured_Query_Language_Settings|"My SQL Connector"]]
* Customised [[Cumulus.ini_(MX_3.0.0_to_3.7.0)#MQTT|MQTT]] commands
 
=Rules=
Now we get to the terminology for what this Wiki page will document.
 
Tag names and parameters must obey certain rules.
The parameters shown in the general format above are of two kinds:
# Input modifying
# Output modifying
 
You can include both optional input modification, and optional output modification parameters
* As the general format above shows, you separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>.
** In that example, the time only is returned for the highest ever temperature in July, after processing by Cumulus of the time-stamp web tag.
 
=== Case sensitivity for parameterstag names ===
 
The tag_name in the general format above is case sensitive, so please type the tag name exactly as shown in lists of tag names.
 
== Case sensitivity for parameters ==
 
The optional input modification parameters always use lower case, so please type them exactly as shown in the [[#Input modification Parameters|section below]].
 
The content of optional output parameters are onlymostly case insensitive when used in legacy Cumulus 1 (a few are case sensitive as explained in [[#For the legacy software]]. For Cumulus 2 and later, so this includes MX, the output parameters are case sensitive and also dependent on what other output formatters are being used if any, so please read the sections on output parameters and study the examples in the tables carefully.
 
== Tag names and Parameters available==
For Cumulus 2 and later, so this includes MX, the output parameters are case sensitive and also dependent on what other output formatters are being used if any, so please read the sections on output parameters and study the examples in the tables carefully.
 
=== Input modification Parameters ===
 
'''Most web tags do not require any input parameters'''. Luckily, where they are needed, it is quite simple to use them, see table below.
 
* An input parameter is used where the same web tag can represent a value for a number of different past time instants.
* Each of those past time instants is represented by a different value for the input parameter.
* So a combination of web tag name and input modification parameter lets Cumulus select the value you want to see.
* The web tags that can use input modification parameters will depend on which Cumulus release you are using
 
{| class="wikitable" border="1"
! scope="row"| Tag names listed at [[Webtags#Table of Recent History tag names available|'''Table of Recent History tag names available''']] (see [[Recent history]] page for explanation)
| One value for each minute in last 7 days
| * '''d''' specifies number of days ago,
* '''h''' specifies number of hours ago,
 
* and '''hm''' specifies number of hoursminutes ago,.
 
and '''m''' specifies number of minutes ago.
* You can use any combination of the three parameters.
* The same d, h, and m, parameters are used by Cumulus 1 and MX.
| Examples for outside temperature:
* <#RecentOutsideTemp m=1> will give the temperature one minute ago, <#RecentOutsideTemp h=1> will give the temperature one hour ago (as will <#RecentOutsideTemp m=60>).
* <#RecentOutsideTemp d=1> will give the temperature one day ago.
** ''''''Please note:''' Some Cumulus users say that using <#RecentOutsideTemp d=1 m=1> is more reliable at getting the temperature (or whatever tag name you have quoted) at a similar time the day before, the extra minute apparently gives better results when you might not be using Cumulus all the time, or your weather station might have some drift on when it supplies readings. See which works best for you.
|-
* <#RecentOutsideTemp d=1 h=1 m=1> will give the temperature one day, one hour and one minute ago.
|All values supplied for parameters must be whole numbers.
* ''If you don't supply any parameters, the result is undefined for Cumulus 1, and an illegal web tag for MX''.
* '''Beware: If you use <code><#RecentRainToday d=2></code> remember that rainfall can accumulate during a day, so "d=2" returns an estimate of the rain between rollover 2 days ago and the same time as now 48 hours ago, it does not return the total rainfall 2 days ago!
! scope="row"| [[Webtags#Monthly_All_Time_Records|'''monthly all-time extreme records''']] tag names
* ''''''Please note:''' Some Cumulus users say that using <#RecentOutsideTemp d=1 m=1> is more reliable at getting the temperature at a similar time the day before, the extra minute apparently gives better results when you might not be using Cumulus all the time, or your weather station might have some drift on when it supplies readings. See which works best for you.
| These tag names represent extreme record values (and corresponding time-stamps) for any particular month (1 =January, and so on, to 12 =December) in all years
|-
| Optional input parameter is '''mon=N''' where N is the index of the month in which the extreme record occurs considering all years
! scope="row"| [[Webtags#Monthly_All_Time_Records|'''monthly all-time extreme records''']]
| These exist for all occurrences of the current month, and for all occurrences of each month
| '''mon=N'''
 
where N is the index of the month of the year that you want the value for (1 =January, and so on, to 12 =December)
| Cumulus 1.9.3 beta build 1033 (remain available in MX)
| * <#ByMonthDewPointH mon=3> is highest monthly dew point for anymonth of March considering all years, and <#ByMonthDewPointHT mon=3> is the related time and date.
* <#ByMonthTempH mon=3> gives highest temperature in any March, <#ByMonthTempHT mon=3> gives the date and time for that highest temperature
 
| * If you don't supply an input parameter (or supply an invalid value like zero) the current month will be used.
<#ByMonthTempH mon=3> gives highest temperature in any March, <#ByMonthTempHT mon=3> gives the date and time for that highest temperature
| Only one input parameter applies:
* The value of "N" supplied should be an integer between 1 and 12
* IfYou youcan don'tuse supplyboth an input parameter (or supplyand an invalidoutput valueparameter likefor zero)any thetag currentname, monthseparate willthese bewith used.a space
 
'''NOTE:''' Use without an input parameter appliesin if"MySQLConnect", "MQTT", or a template file, and then you wantdon't need to writerewrite athe templateinstruction thatwhen willcurrent alwaysmonth supplychanges. valuesIf forprocessed at rollover, the current month andwill don'tchange wanton tofirst processday of a scriptmonth, toand calculateso thenot correctrelate inputto parameter,month beforethat Cumulushas processesjust the templatefinished.
|-
! scope="row"| [[Webtags#Monthly|Only <#SunshineHoursMonth>]] and [[webtags#Yearly|Only <#SunshineHoursYear>]]
| Values available for current month/year, and for past month/year
| Omit input modification parameter to get value for current month/year. Alternatively include one of the following options:
| Listed web tags take: '''r=-ww''' (note minus sign and up to 2 digits)
* '''r=-ww''' (note minus sign and up to 2 digits) representing that number of months/years ago
* Monthly tags also take: '''m=N y=nnnn''' ('''N''' can be 1 to 12, ''nnnn'' is 4 digit year)
* YearlyMonthly tags also take: '''m=N y=nnnn''' ('''N''' can be 1 to 12, ''nnnn'' is 4 digit year), these parameters specify exact month required
* Yearly tags also take: '''y=nnnn''', this parameter specifies exact year required
Omit input modification parameter to get value for current month/year
| MX release 3.12.0
| Monthly examples:
|}
 
=== Output modification parameters availability by tag name ===
 
Each tag name falls into one of these 3 types:
* Some tag names have a fixed output format (so they ignore any output format parameters, although obviously better not to specify any)
* Some tag names always need an output format specifier
* The majority of tag names have a default output if there is no output format modifier, but accept either one or two output format parameters, allowing you to change what they output.
 
This Wiki page does not include a table showing which tags belong to which type, simply because it is dependent on which Cumulus release you are running. An attempt to indicate some general guidance has been included on another [[Webtag_Applicability|discussion about applicability]] Wiki page, but contributors need to update that page and start listing tag name and release specific information.
 
===Output modification parameters available in legacy Cumulus 1===
 
Your options are described under the following subheadings:
This page does not tell you which web tags fall into each of these 3 types:
* [[#Rounding to a specific number of decimal places]]
* A few web tags always need an output format specifier
* [[Multiple Output Format Modifier parameters for times and dates]]
* Some web tags ignore any output format specifier as they have a fixed output format
* The majority of web tags have a default output if there is no output format modifier, but accept an output format parameter, so you can change what they output.
 
===Additional output modification parameters that are only available for MX users===
To make life more complicated, the availability of output format parameters for particular web tags is dependent on which Cumulus release you are running. There is a general [[Webtag_Applicability|discussion about applicability]], but that needs updating as it does not specify dependencies for individual [[Webtags|web tags]].
 
[[File:Badge vMx.png]]If youoffers arethose usinglisted MXabove for Cumulus 1, plus:
* [[#Output Modification Parameter for changing any decimal comma into a decimal point]]
* if your locale specifies that integer and decimal parts of real numbers are separated by a comma, there is an output parameter to replace that decimal comma by a decimal point for any script that does not recognise decimal commas
* there[[#Controlling are two output modifiers for changingthe number of decimal places]]
* [[#Two Output (format modifier) parameters for decimal places]]
* there are multiple output modifiers for changing date and/or time format
* [[#Truncation of unwanted decimal places]]
 
=Documentation for Output modification parameters=
If you are using the legacy Cumulus (or a very early MX release), please skip to [[#Two Output (format modifier) parameters for decimal places]] as the changing decimal comma into decimal point parameter is not available to you.
 
Use the links above to skip to the particular parameters that you wish to use.
Each of these will be explained in turn.
 
==Output Modification Parameter for changing any decimal comma into a decimal point==
 
Note that Cumulus software never uses a comma for separating off thousands, and there is no way to make it output numbers above 999 with a space or comma to separate out thousands.
General format: <tt><#tag_name rc=y></tt>
 
If the tag name represents a real number with integer and decimal parts, then Cumulus by default will output that number using whatever your locale defines as the separator character (decimal comma or decimal point). The legacy Cumulus 1 provided a few derivatives where a prefix of "RC" before tag name as in <code><#RCtag_name></code> could force the output to use a decimal point (regardless of locale), that option remains available in MX for forward compatibility.
This only applies:
*if the web tag name represents a real number with integer and decimal parts
*if you are using MX
**From beta release 3.0.0, build 3047 (3 February 2019), up to and including release 3.5.3, only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge)
**From release 3.6.6 onwards (1 June 2020), it was extended to other web tags that output real numbers.
**From release 3.10.5 onwards (29 March 2021), the use of <tt><#tag_name rc=n></tt> became also possible, to ensure decimal comma shown when locale specifies it
 
In Cumulus MX (only), you can alternatively use an output modification parameter in format <tt><#tag_name rc=y></tt> to select whether the output should use decimal comma or decimal point:
This output modification format parameter can be used to replace all commas in the output by a full stop (don't worry, MX does not use a comma for separating off thousands, so it is the decimal comma that becomes a decimal full stop like character when this remove comma specifier is used).
*From beta release 3.0.0, build 3047 (3 February 2019), up to and including release 3.5.3, only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge)
*From release 3.6.6 onwards (1 June 2020), it was extended to other web tags that output real numbers.
*From release 3.10.5 onwards (29 March 2021), the use of <tt><#tag_name rc=n></tt> became also possible, to ensure decimal comma shown when locale specifies it
{| class="wikitable" border="1"
|-
 
 
'''Why would you want to remove decimal commas?''' Well because the JavaScript language (and some other languages) cannot understand decimal commas, and MX has several scripts written in this language, equally some third party alternative web pages rely on ajax to update them (and Ajax uses JavaScript).
 
==Controlling the number of decimal places==
 
If the tag name represents a real number (with both integer and decimal parts) then there are a number of ways to control the number of decimal places:
Internally, Cumulus stores numbers in binary. You cannot represent base 10 decimal places exactly in base 2.
* [[File:Badge v1.png]]Cumulus 1.x.y: <tt>dp=i</tt> rounds output to number of decimal places specified by "i"
* [[File:Badge vMx.png]] All MX releases: <tt>dp=i</tt> rounds output to number of decimal places specified by "i"
* <tt><#tag_name tc=y></tt> truncates output, display as integer, no rounding, simply ignoring all decimal places
 
If the tag name gives an output that is defined as text, or as an integer, then none of these can be used. It depends upon which release you are using whether a particular "real number" tag name will accept any of the above output modification parameters, gradually Cumulus has allowed more and more of its output to take an output format modifier that allows people to control number of decimal places shown.
Therefore, Cumulus stores to a precision that would generally give about 24 significant figures when expressed in base 10.
 
Internally, Cumulus stores numbers in binary. You cannot represent base 10 decimal places exactly in base 2.
Cumulus is written to assign particular numbers of decimal places to any outputs it makes, and in any logging of current, or extreme values (for day or longer periods). It determines these precisions, by reference to the units chosen for outputs.
 
Weather stations report [[Calculate_Missing_Values#Source_value|values]] as integers. Cumulus converts these to the user's desired units, and that processing can add decimal places, as it may involve division by a factor of 10, or multiplication by a conversion factor. Obviously, the sensor has a particular accuracy, and this conversion process can introduce additional errors, as can the storing in binary, Cumulus generally (not in every case) stores to a precision that would generally give about 24 significant figures when expressed in base 10.
[[File:Badge vMx.png]]From release 3.12.0, you can set the default number of decimal places to output for all derivatives of temperature, pressure, etc. by [[Cumulus.ini#Units.2C_Derivative_Options.2C_and_Decimal_Places|advanced settings]]. Those settings can force output as integers, stopping these modification parameters from working.
 
AsThe handling of each web tag name is coded individually, so there are no simple rules for defining the default number of decimal placespoints outputthat bywill defaultbe inshown anyby webdefault. tagIn mightgeneral, varyCumulus slightlydoes fromconsider the aboveunits defaultchosen for outputs. As Cumulus has been developed, people have commented that these defaults do not reflect the precision of their instrumentation (weather stations used with Cumulus tend not to have the accuracy of those used by meteorologists, or are not re-calibrated as often).
 
[[File:Badge vMx.png]]From release 3.12.0, you can set the default number of decimal places to output for all derivatives of temperature, pressure, etc. by [[Cumulus.ini#Units.2C_Derivative_Options.2C_and_Decimal_Places|advanced settings]]. Those settings can force output as integers, in which case the parameter for controlling number of decimal places have no effect.
This section (and its subsections) only applies to tag names that output real numbers (with integer and decimal parts). You can't change anything that is output as an integer, or is text with these parameters, nor can you change the decimal places for any time element.
 
Consequently, gradually Cumulus has allowed more and more of its output to take an output format modifier that allows people to control number of decimal places shown.
 
===Two Output (format modifier) parameters for decimal places===
 
Depending on tag name and release you are using, there may be two ways to control decimal places:
[[File:Badge vMx.png]]From release 3.10.5 (which did a big rewrite of web tag handling), you can modify real number output for individual tag names, using output modification parameters in either of the following formats:
* <tt><#tag_name dp=i></tt> and
* <tt><#tag_name tc=y></tt>
These can be applied to any tag names that represent real numbers (with integer and decimal parts).
 
====Rounding to a specific number of decimal places====
 
Use <tt>dp=i</tt> (the value '''i''' following the attribute '''dp''' is an integer, it represents how many decimal places you want for the output you see):
<tt>dp=i</tt> is used for both Cumulus 1 and MX.
* [[File:Badge v1.png]]Cumulus 1.x.y: only <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> are able to be output with "i" denoting number of decimal places, e.g. <#latitude dp=5> gives "59.24250".
*The value '''i''' following the attribute '''dp''' is an integer, it represents how many decimal places you want for the output you see.
* [[File:Badge vMx.png]] Depends on MX release:
 
*# From beta releases (3.0.0) onwards, <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> were able to be output with "i" decimal places
This functionality was trialled in the original Cumulus, but has been properly implemented in MX.
*#* But this output modification parameter could not be applied to any other tags in the MX beta.
 
*# MX when it came out of beta, added this output modification parameter usage in the moon tags <#MoonPercent> and <#MoonPercentAbs>).
If you are using the legacy Cumulus (1.9.4), only <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> were able to be output with "i" denoting number of decimal places, e.g. <#latitude dp=5> gives "59.24250".
*#* Specifically, <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234"
 
*# From release 3.10.5 (which did a big rewrite of web tag handling) any tag names that output as real numbers
If you are not using latest MX release, you may find this is not available for particular web tag names
# From beta releases (3.0.0) onwards, <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> were able to be output with "i" decimal places
#* But this output modification parameter could not be applied to any other tags in the MX beta.
# MX when it came out of beta, added this output modification parameter usage in the moon tags <#MoonPercent> and <#MoonPercentAbs>).
#* Specifically, <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234"
====Truncation of unwanted decimal places====
 
[[File:Badge vMx.png]]This output format modifier is only available in MX.
 
<tt>tc=y</tt> is the truncation parameter, the attribute '''tc''' takes the value 'y' to remove decimal places by truncation. e.g. <#MoonAge tc=y>.
 
[[File:Badge vMx.png]]This output format modifier is only available in MX:
Whilst many people want Cumulus to round output as done by the previous parameters, there are circumstances when rounding down (or truncation) gives the result desired.
 
* If you are using an early release of MX, you will need to research whether this is available for particular tag names
* Later releases of MX implement this for any tag that by default outputs decimal places.
== Multiple Output Format Modifier parameters for times and dates ==
 
Output modification parameters for times and dates are highly complicated!
These are highly complicated, and so have been left until after the simpler ones!
 
To start with a simple example, suppose you want date/time in ISO 8601 format:
# Take the tag name (from tables on [[Webtags]] page)
# Next check in [[#Which tag names take date/time output formatting modifiers]] to see if that tag accepts both time and date modifiers
# If ouryour tag name does accept both date and time modifiers, simply modify the web tag as shown here <code><#tag_name format="yyyy-MM-dd HH:mm:ss"></code> where tag_name is set from step 1, but all the rest is typed as shown.
# To explain each element in that format value, look in [[#Time formats]], [[#Year formats]], [[#Month formats]], [[#Day formats]], [[#Use of spaces]], [[#TimeIncluding formatsliterals in format parameters]].
 
Should you want a different date/time format, then the sub-sections just referenced should help you to select a different arrangement, although there are some more options in [[#Date formats]].
===Which tag names take date/time output formatting modifiers===
 
ThereWhen arecounted nearlysome time ago MX already offered a thousand different tag names.
 
There are a few time-related tag names labelled as being fixed format, that means any time/date output modifiers you might try would be ignored.
 
Some tag names, although it can be hard to tell which, report durations. You can use time modifiers to change how these are reported. Examples include '''<#daylength format=H:mm:ss>''' which reports day length and '''<#MonthDailyRainHD format=H:mm>''' which reports how much of a day it was raining.
 
Time modifiers can also be used to change the way that clock times are reported, you might only want the hour, or you might (if resolution is available) want to also see seconds. The [[webtags]] page has columns headed "Time" to clearly identify all tag names that report clock times.
 
There are some tag names (e.g. moon rise) that relate to an event that does not happen each Earth day, so those tags have to be able to report "--:--", and you cannot modify their output. Equally, many of the tag names that describe extreme records for this month/year/all-time are not defined until the respective period reaches its second day, so again those tags may output hyphens and so any modification parameters will be ignored. For example, highest temperature range in month/year has been coded in Cumulus to report "--" for value, and "--:--" for time, on the first day of that period (because there is only a partial day to consider you might not yet have experienced a true maximum and a true minimum), so modifying the time output can only be done on subsequent days.
 
There are some tags (e.g. highest temperature range in month/year), for which Cumulus has been coded to report "--" for value, and "--:--" for time, on the first day of that period (because there is only a partial day to consider you might not yet have experienced a true maximum and a true minimum), so modifying the time output can only be done on subsequent days.
 
It is not practical to indicate which time/date modifiers are accepted on a tag by tag basis. It would involve a lot of repetition. Instead, the following table, explains much more simply, which web tags will accept time and/or date output modifiers:
|-
! scope="row"| [[Webtags#Monthly]], [[Webtags#Yearly]]
| AnyThose tag namenames in "Time" column of linked table in first column that represent spot value extreme records. For notes see ~ below this table
| Any tag name in "Date" column of linked table in first column that represent either daily extremes or spot value extreme records. For notes see &dagger; below this table
| None of the tag names. For explanation see the ^ below this table
|-
! scope="row"| [[Webtags#All_Time]], [[Webtags#Monthly_All_Time_Records]]
| None (all tag names combine both time and date)
| Those tag names in "Date/Time" column of linked table that represent daily extremes
| None (all tag names combine both time and date)
| AnyThose tag namenames in "Date/Time" column of linked table that represent spot value extreme records
|-
! scope="row"| [[Webtags#Davis]]
| None
|}
~ For rainfall, only '''<#LastRainTip>''' can have output modifiers added to report a clock time.
&dagger; Daily extremes (e.g. wettest day <#MonthDailyRainHD>, and temperature ranges <#MonthHighDailyTempRangeD>) have no time tag.
^ For the monthly and yearly web tags, the date and time are in separate tag names. It is not possible to get both time and date out of either tag name.
 
Note: There are some monthly/yearly web tags (e.g. wettest day) where a date tag is available (i.e. <#MonthDailyRainHD>), but there is no time tag. As explained before, in that wettest day example '''<#MonthDailyRainHD format=H:mm>''' returns the duration in hours and minutes since rollover for which rain continued to increase on that date, not the clock time. For rainfall, only '''<#LastRainTip>''' can have output modifiers added to report a clock time.
 
===Locales===
The effect of some output format modifiers is also dependent on locale.
 
For Microsoft Windows Operating Systems, a Language is defined within the "Region" page of the Settings app. That should be sufficient for the legacy software that uses Delphi. However for MX date and time formats within Windows Operating System, you must use the older '''Control Panel''' (go to "Clock and Region" screen, choose "Change date, time or number formats", choose "Language preferences") because it is only there that you can adjust all the defaults used by .NET.
[[File:Badge vMx.png]]For MX running on most operating systems (and therefore using Mono), type <code>locale</code> to see the default locale that will be adopted when mono-complete is installed as MX will, by default, take locale setting from Mono. When you start MX, you can ask it to use a different locale to that picked up by Mono, by adding the parameter "-lang locale-code", see examples at [[MX_on_Linux#Parameter_for_changing_Locale]]. For example, the Australian English language with UTF-8 encoding locale is defined as: en_AU.UTF-8.
 
[[File:Badge vMx.png]]For MX running on most operating systems (other than Microsoft Windows), type <code>locale</code> to see the default locale that will be adopted when mono-complete is installed as MX will, by default, take locale setting from Mono. When you start MX, you can ask it to use a different locale to that picked up by Mono, by adding the parameter "-lang locale-code", see examples at [[MX_on_Linux#Parameters]]. For example, the Australian English language with UTF-8 encoding locale is defined as: en_AU.UTF-8.
 
The available locales on your computer in Linux are listed by <code>locale -a</code>. For example, the Russian locale would be selected as the one your computer uses ''for the current session only'' by using <code>LANG=ru_RU.utf8</code> either typed into a terminal session before you start MX, or used as a parameter (preceded by "-") as you start MX interactively.
 
For permanently changing the locale used by your system, the instructions vary considerably according to the kernel used in your operating system, so you need to look up the instructions for yourself. However, if you have a graphical user interface, such as the full Raspberry Pi Operating System provides, you might have a configuration command in terminal mode and a configuration app accessed (within ''Preferences'') from the "Raspberry" key on the official keyboard. For the Raspberry Pi, please read [[Raspberry Pi computer page]] for more details.
 
For Microsoft Windows Operating Systems, a Language is defined within the "Region" page of the Settings app. That should be sufficient for the legacy software that uses Delphi.
 
However for MX date and time formats within Windows Operating System, you must use the older '''Control Panel''' (go to "Clock and Region" screen, choose "Change date, time or number formats", choose "Language preferences") because it is only there that you can adjust all the defaults used by .NET.
 
===Time zones===
All web tag outputs are in local time, except '''<#timeUTC>'''.
 
Although Cumulus 2 internally stored all date/times in UTC, noand flavourthe development of CumulusMX is currently ableplanned to outputattach theUTC timedate-stamptimes forto anyall weatherdata extremealthough in(at UTC,time ifof yourtyping currentthis) timethis is not inyet UTCimplemented so MX maintains compatibility with Cumulus 1 legacy software.
 
[[File:Badge vMx.png]]However,In formost MX onlyreleases, you can use a script to convert a time to UTC. This is not the place to tell you how to write the script, but taking time of highest pressure today as an example, you would use <#TpressTH format=Hh:mm> and <#TpressTH format=zzz>, the first gives hours and minutes in your local time, and the second gives the offset that needs to be applied to that time to convert it to UTC.
 
===Time resolution===
 
For the legacy software, there may be no point in asking for seconds, as Cumulus 1 did some actions at one minute intervals. For MX, it depends on which tag name you are using whether it supports seconds (e.g. <#LastDataReadT> supports seconds, but <#LastRainTip> is reported rounded back to previous minute and <#TrrateTM> is reported rounded forward to the next minute).
 
If Cumulus obtained archive data, as part of the catch-up process it can do when it restarts, any time-stamps for that historic period can only be the time of a particular archive record, so that might be every half an hour, but not aligned precisely with hour changes.
 
===Dependency on Cumulus flavour===
 
You cannot,inhave general,to usechange the sameall date/time formatting forwhen moving bothfrom the original (legacy) Cumulus andto MX.
 
All the tables explaining what is available, attempt to show what is used in each flavour for each type of output, both by including separate columns for each flavour, and by giving examples in each flavour.
 
====For the legacy software====
*If Cumulus MX is running on any Linux distribution (including Raspberry Pi Operating Systems) or Mac OS X, or any other device that uses an UNIX derived operating system, then MX uses '''Mono''' software for same purposes. (MONO is a operating system independent version of .NET, although they are developed independently, they have common origins).
 
===Use of spaces===
 
===Time formats===
There are multiple symbols for specifying dates and times, and you might want spaces to appear between symbols in that output format.
 
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.
[[File:Badge vMx.png]]You need to add quotation marks to the output format specifier if spaces are present. You also may need to add "%" or "space" before the first modifier within the double quotation marks, as without it you may get an unwanted format!
 
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" | [[File:Badge v1.png]]Delphi Specifier for Cumulus 1.9.x
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|h
|%h
|Displays the hour (12 hour clock) without a leading zero (1-12)
| 7
|-
|h ''AM/PM''
|%h ''tt''
|Displays the hour (12 hour clock) without a leading zero (1-12) in combination with AM/PM.
 
[[File:Badge v1.png]]For Cumulus 1 the formats for am/pm depend on the case in which you type the parameter as shown later in this table
[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows. In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead, understanding that space is not a gap between characters, but an alternative to "%". I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.
 
[[File:Badge vMx.png]]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).
''For a space character to be interpreted as a gap between symbols, the symbol that follows the space must include at least two characters.'' The syntax <code><#tag_name format="x y z"></code> works if the y and z in it are representing multi-character symbols. To explain this, an example is '''<#TpressTH format=" h:mm tt">''', in that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''tt'' are multi-character symbols, that does mean insert a space after the minutes.
| [[File:Badge v1.png]]7 PM
|-
|h:nn [''AM/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].
 
[[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' (instead of "nn") only when appearing in combination with 'h'
If we have single character specifiers, then a space has to be enclosed in single quotes to mark it as a literal, not a modification of the subsequent single character. To explain this, a simple example is '''<#MonthPressHD format=" d' 'M">''', in this example the "space" before "d" is
|'10:27 am' produced by [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm">[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt">
treated as same as "%", but since the month number is a single character "M", the space before it can only be treated as a "space" if we treat it as a literal by enclosing the space character in single quotes and the whole specifier in double quotes.
|-
|H (or ''H'')
|%H
| Displays the hour part of any duration or clock time, without a leading zero (0-23).
 
[[File:Badge vMx.png]]Note that '%' before the "H", this makes it a custom modifier, needed because H is on its own.
Literals are discussed fully in the [[#Including literals in format parameters]] sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes. An example, that shows all the options that MX allows, with literals is <code> <#TpressH format="\a't 'h:mm'&nbsp;' tt' <nowiki><small>on 'd/M/yyyy' </small></nowiki>'"> </code>.
|7 produced by
* [[File:Badge v1.png]]<#daylength format=H>
*[[File:Badge vMx.png]]<#daylength format=%H>
|-
| H:mm (or ''H:nn'')
| 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 (or ''hh'')
|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 [''am/pm''][''AM/PM'']
|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].
 
[[File:Badge v1.png]]For Cumulus 1, two optional terms are shown because the case output for the optional 'am/pm' depends on the case used for that parameter
 
[[File:Badge vMx.png]] For MX, 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
* [[File:Badge v1.png]] <#LastDataReadT format="hh am/pm">
*[[File:Badge vMx.png]] <#LastDataReadT format="hh tt"> if locale specifies lower case
|-
|hh:mm (or ''hh:nn'' or 'HH:NN') [''am/pm''][''AM/PM'']
|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].
* [[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' only when in combination with 'h', in other contexts 'mm' is interpreted as month number, two optional terms are shown because the case output for the optional 'am/pm' depends on the case used for that parameter
*[[File:Badge vMx.png]] For MX, 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
* [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm">
*[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt"> if locale specifies lower case
|-
|n
|%m
|Displays the minutes of any duration or clock time, without a leading zero (0-59).
 
[[File:Badge vMx.png]] As other examples show, the % is only needed when "m" is on its own.
| 7 produced as a duration in minutes by
* [[File:Badge v1.png]]<#daylength format=n>
*[[File:Badge vMx.png]]<#daylength format=m>
|-
|nn
|mm
|Displays the minutes of any duration or clock time, with a leading zero (00-59).
|'07' produced as a duration in minutes by
* [[File:Badge v1.png]]<#daylength format=nn>
* [[File:Badge vMx.png]]<#daylength format=mm>
|-
|s
|%s
|Displays the seconds for any duration or clock time, that has resolution to less than a minute, without a leading zero (0-59).
 
[[File:Badge vMx.png]] As other examples show, the % is recommended when "s" is on its own, although I have not found any alternative meaning for "s" on its own.
| 9 produced by <#metdate format=s>
|-
|ss
|ss
|Displays the second with a leading zero (00-59).
|'06' or 19 produced by <#LastDataReadT format=ss>
|-
|z
|FFF
|Displays the millisecond without a leading zero (Cumulus 1: displays 0-999, Cumulus MX: 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.
|
|-
|(not available)
|ff (or ''f'')
|Displays hundredths of a second (or tenths) with leading zero(s)
|
|-
|zzz
|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.
 
[[File:Badge vMx.png]]The 'fff' modifier in MX can actually be extended to 'ffffff' for output to a millionth of a second!
| 09:47:25.000' produced by
* [[File:Badge v1.png]]<#time format=hh:nn:ss.zzz>
*[[File:Badge vMx.png]]<#time format=hh:mm:ss.fff>
|-
|(not available)
| zzz
|Displays the offset of any time from UTC in hours and minutes
| e.g.-07:00
|-
|(not available)
|"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 I understand correctly)
|(no examples supplied yet)
|-
|t
|%t
|Displays the time using the Short Time format.
 
[[File:Badge vMx.png]]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) for both flavours of Cumulus
|-
|am/pm or Am/Pm or AM/PM
|tt
| [[File:Badge v1.png]]Uses the 12-hour clock for the preceding h or H specifier, and displays 'am' for any (clock time) hour from midnight until just before noon, and 'pm' for any hour from noon onwards. The am/pm specifier for Cumulus 1 can use lower, upper, or mixed case, and the result is displayed accordingly.
 
[[File:Badge vMx.png]] For MX, '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".
| [[File:Badge v1.png]] 'am' produced by <#LastDataReadT format=am/pm>, 'AM' produced by <#LastDataReadT format=AM/PM>
|-
|h a/p
|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.
 
[[File:Badge v1.png]]The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
 
[[File:Badge vMx.png]]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
|-
|ampm
|(see above for 12 hour formats)
|This 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.
[[File:Badge v1.png]]Uses the 12-hour clock for the preceding h or H specifier
| see previous examples
|-
|/
|/
|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. With Cumulus 1, this might not display a colon.
 
[[File:Badge vMx.png]]Note that by default Cumulus MX expects a locale to use ":" for any time separator.
|':' for British locale
|}
 
Finally, the use of literals can cause you ''a problem if you want to use a date/time specification in a script'' because the script wants literal delimiters outside any web tags, so that delimiters remain when the web tag itself has been processed into a string by Cumulus. This means the type of quotes (single or double) used outside the web tag, cannot be used within the web tag. The complicated sounding (but actually simple solution) is to avoid placing literals, and/or spaces, within any output format specifier, instead put single quotes round the whole content. What you thought of putting as literals within any web tag is instead typed outside with separate web tags for the part of the specification before and after each literal. An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal.
 
===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 neededthat are mandatory for MX:
 
{| class="wikitable" border="1"
All locales offer both numerical and alphabetical formats for representing months.
*In the following table "MMM" is shown as producing short month name.
**What language is used, and whathow many characters appear, depend on what is set up for your language in your settings (by default or by you changing your settings)
** In British English (UK)Australian locale, this willwould beoutput the4 appropriatecharacters 3representing lettera month abbreviation that startsruns withfrom "Jan." and runs to "Dec."
**It appearsIn thatBritish languageEnglish settings(UK) inlocale, manyabbreviations localesdo (not "en-gb"), addincude a full stop, toso anyoutput abbreviationsis and in that case thea 3-letter "MMM" is turned into a 4-letter outputabbreviation (e.g.that Australiastarts settings default would output fromwith "Jan." and runs to "Dec.")
*** MX has been coded to remove that full stop in various places (like in standard log file naming and NOAA report naming), but at the time this section was edited, "MMM" still reports the full stop in a web tag output if your locale uses it
*In the following table "MMMM" is shown as producing the full name for a month
**The output you get will depend on the language defined in your locale
**In all English based locales, the output will be in the range "January" -to "December"
 
[[File:Badge vMx.png]]'''CAUTION:''' Cumulus MX has yet another complication, a web tag can return different months depending on whether the output modifier for month is used with, or without, an output modifier for day. Take two examples <code><#metdateyesterday format=yyyy-MM-dd></code> and <code><#metdateyesterday format=yyyy-MM></code>, these can produce different months when processed by MX on same day at near enough same time! Let us assume the first is reporting (in a particular year) the first day of June, the second would in that case report the samemonth year,of butMay couldin reportsame the month of Mayyear!
 
{| class="wikitable" border="1"
|Displays the month as a number without a leading zero (1-12).
* [[File:Badge v1.png]]Cumulus 1.x.y:If the 'M' or 'm' specifier immediately follows an h, hh, HH, or H specifier, the minute rather than the month is displayed.
* [[File:Badge vMx.png]]Cumulus MX: Note that including a ' ' (space) or '%' before the M makes it a custom modifier, so giving a different fromoutput to the '''format=M''' included in previous table in [[#Date formats]] subsection.
|2
|-
|MMM
|Displays the month using the strings defined for '''short month name''' in the Locale.
|'Jun.' or 'Jun' produced by <#metdate format="MMM"> (varies depending which English locale as explained before table)
|-
|MMMM (or ''mmmm'')
All locales offer both numerical and alphabetical formats for representing a day.
 
[[File:Badge vMx.png]]Again, there are extra complications with MX, the "d" modifier is not shown because it is inconsistent, the format it returns depends on which tag name it is used with - see [[#Date formats]] table later! For some tag names it returns just "day of month" (like "%d"), for others it returns the full "Short date format" (like "ddddd")!
 
The table below is the definitive guide to how to ensure you do specify just the day part of any date specifications.
|ddd (3 characters long)
|ddd
|Displays the day as an abbreviation (in UK EnglishAustralian will output "Sun-." to "Sat.") using the strings appropriate to the Locale (see note for month abbreviation).
|'Wed' produced by <#metdate format="ddd"> (UK English locale)
 
As for month above, the short day names that are generated depend on your locale, so you might see additional punctuation defined for abbreviated names in some locales (e.g. 'Wed.').
|-
|dddd (4 characters long)
!style="width:600px" | Example
|-
| c
| G (as single character format)
| Displays the date using the format given by the Short Date format, followed by the time using the format given by the Long Time format. The time is not displayed in Cumulus 1 if the date-time value indicates midnight precisely.
| '22/03/2019 09:47:25' produced by [[File:Badge v1.png]]<#time format=c>[[File:Badge vMx.png]]<#time format=G>
|-
| ddddd (5 characters long)
| ddddd (5 characters long)
|d (as single character format)
| 'ddddd' will output the date using the format given by the Short Date format.
| Flavour issues:
* [[File:Badge v1.png]]Cumulus 1.x.y: 'ddddd' will output the date using the format given by the Short Date format.
* [[File:Badge vMx.png]]This MX parameter (when on its own, without space or '%' prefix) displays inconsistent behaviour as its effect depends on the tag name (sorry, there is no definitive list from the MX author specifying effect by individual tag name) with which it is used (you will need to experiment for yourself and compare with the two examples).
| [[File:Badge vMx.png]] '22' returned by e.g. <#yesterday=d>
 
[[File:Badge vMx.png]]'d' (when on its own, without space or '%' prefix) may or may not work, it displays inconsistent behaviour as its effect depends on the tag name (sorry, there is no definitive list from the MX author specifying effect by individual tag name) with which it is used (you will need to experiment for yourself and compare with the two examples).
Short date format e.g. '22/03/2019' (British Locale) produced in MX by either of these:
| * [[File:BadgeShort v1date format e.png]]g. '22/03/2019' (British Locale) produced by <#metdate format=ddddd>
* [[File:Badge vMx.png]]<#metdateyesterday format=For some tag names can use "d>":
** <#metdateyesterday format=d> e.g. '22/03/2019' (British Locale)
** <#yesterday=d> e.g. '22' returned
|-
|dddddd (6 characters long)
|"D MMMM"
|M
|Day of month followed by Month name. (except USA locales).
 
Compared[[File:Badge withvMx.png]] nextNote tablethis whereis different output to '''format=%M''' used,or '''format=" M'"'' on its own returns both(see [[#Month andformats]]). DayNot accordingapplicable to localUSA formatlocales.
| e.g. 22 July (English Locale)
|-
 
 
===TimeUse formatsof spaces===
 
If you are considering use of literals (such as a space) within a output format modifier in a script, then don't. Instead include whatever precedes the literal in a tag specification, then concatenate on the literal, and finally concatenate another tag specification for whatever is to follow the literal. An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext Pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal. The same approach applies if you wanted to replace that "T" with a space. (The explanation is that Cumulus (1 and MX) requires single quotes round a literal, but the script language requires any string to be enclosed in quotes, and double quotes are required by Cumulus round any complex specifier including any that include a space or other literal).
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.
 
[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows. In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead, understanding that space is not a gap between format characters, but simply an alternative to "%" as a special character. To explain the two ways of interpreting spaces consider as an example '''<#TpressTH format=" h:mm tt">'''. In that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''mm'' and ''tt'' are multi-character symbols, that does insert a space after the minutes but before the am/pm. I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.
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" | [[File:Badge v1.png]]Delphi Specifier for Cumulus 1.9.x
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX
!style="width:600px" | Displays
!style="width:600px" | Example
|-
|h
|%h
|Displays the hour (12 hour clock) without a leading zero (1-12)
| 7
|-
|h ''AM/PM''
|h ''tt''
|Displays the hour (12 hour clock) without a leading zero (1-12) in combination with AM/PM.
 
[[File:Badge v1.png]]For Cumulus 1 the formats for am/pm depend on the case in which you type the parameter as shown later in this table
 
If you want spaces to appear between symbols in an output format:
[[File:Badge vMx.png]]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).
* [[File:Badge v1.png]]Cumulus 1.x.y: Add double quotation marks around everything after equals sign if spaces are present anywhere after that equals sign.
| [[File:Badge v1.png]]7 PM
* [[File:Badge vMx.png]] In MX, add double quotation marks around everything after equals sign if spaces are wanted as separators, but you also need to add single quotation marks around the included space.
|-
** If the first symbol after equals sign is a single character modifier, then it has a different meaning depending on whether it is first specificatiion or is preceded by a "%" or "space" as in example above. If the first modifier inclues more than one letter, then it does not ever take a prefix.
|h:nn [''AM/PM'']
** If the space appears after double characters and the symbol that appears after the space is also double characters (as in example above) the single quotes round the space are optional.
|h:mm [''tt'']
** If we have single character specifiers, then a space has to be enclosed in single quotes to mark it as a literal, not a modification of the subsequent single character.
|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].
 
Literals are discussed fully in the [[#Including literals in format parameters]] sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes. An example, that shows all the options that MX allows, with literals is <code> <#TpressH format="\a't 'h:mm'&nbsp;' tt' <nowiki><small>on 'd/M/yyyy' </small></nowiki>'"> </code>.
[[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' (instead of "nn") only when appearing in combination with 'h'
|'10:27 am' produced by [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm">[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt">
|-
|H (or ''H'')
|%H
| Displays the hour part of any duration or clock time, without a leading zero (0-23).
 
[[File:Badge vMx.png]]Note that '%' before the "H", this makes it a custom modifier, needed because H is on its own.
|7 produced by
* [[File:Badge v1.png]]<#daylength format=H>
*[[File:Badge vMx.png]]<#daylength format=%H>
|-
|H:mm (or ''H:nn'')
|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.
 
[[File:Badge vMx.png]]Note that %, of previous example, is not needed as the H is not on its own.
|'6:27' or '17:49' produced by <#LastDataReadT format="H:mm">
|-
|HH (or ''hh'')
|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 [''am/pm'']
|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].
 
[[File:Badge v1.png]]For Cumulus 1 the case output for the optional 'am/pm' depends on the case used for that parameter as shown later in this table
 
[[File:Badge vMx.png]] For MX, 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
* [[File:Badge v1.png]] <#LastDataReadT format="hh am/pm">
*[[File:Badge vMx.png]] <#LastDataReadT format="hh tt"> if locale specifies lower case
|-
|hh:mm (or ''hh:nn'' or 'HH:NN') [''am/pm'']
|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].
* [[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' only when in combination with 'h', in other contexts 'mm' is interpreted as month number, and the case output for am/pm depends on the case used for that parameter as shown later in this table. As Cumulus 1 is case insensitive there are variants with capital letters available.
*[[File:Badge vMx.png]] For MX, 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
* [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm">
*[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt">
|-
|n
|%m
|Displays the minutes of any duration or clock time, without a leading zero (0-59).
 
[[File:Badge vMx.png]] As other examples show, the % is only needed when "m" is on its own.
| 7 produced as a duration in minutes by
* [[File:Badge v1.png]]<#daylength format=n>
*[[File:Badge vMx.png]]<#daylength format=m>
|-
|nn
|mm
|Displays the minutes of any duration or clock time, with a leading zero (00-59).
|'07' produced as a duration in minutes by
* [[File:Badge v1.png]]<#daylength format=nn>
*[[File:Badge vMx.png]]<#daylength format=mm>
|-
|s
|%s
|Displays the seconds for any duration or clock time, that has resolution to less than a minute, without a leading zero (0-59).
 
[[File:Badge vMx.png]] As other examples show, the % is recommended when "s" is on its own, although I have not found any alternative meaning for "s" on its own.
| 9 produced by <#metdate format=s>
|-
|ss
|ss
|Displays the second with a leading zero (00-59).
|'06' or 19 produced by <#LastDataReadT format=ss>
|-
|z
|FFF
|Displays the millisecond without a leading zero (Cumulus 1: displays 0-999, Cumulus MX: 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 Windows.
|
|-
|(not available)
|ff (or ''f'')
|Displays hundredths of a second (or tenths) with leading zero(s)
|
|-
|zzz
|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 Windows.
 
[[File:Badge vMx.png]]The 'fff' modifier in MX can actually be extended to 'ffffff' for output to a millionth of a second!
| 09:47:25.000' produced by
* [[File:Badge v1.png]]<#time format=hh:nn:ss.zzz>
*[[File:Badge vMx.png]]<#time format=hh:mm:ss.fff>
|-
|(not available)
| zzz
|Displays the offset of any time from UTC in hours and minutes
| e.g.-07:00
|-
|(not available)
|"h:mm K"
|Effectively another way of including time zone after a time, but it can only be used for times not in UTC (if I understand correctly)
|(no examples supplied yet)
|-
|t
|%t
|Displays the time using the Short Time format. [[File:Badge vMx.png]]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) for both flavours of Cumulus
|-
|am/pm or Am/Pm or AM/PM
|tt
| [[File:Badge v1.png]]Uses the 12-hour clock for the preceding h or H specifier, and displays 'am' for any (clock time) hour from midnight until just before noon, and 'pm' for any hour from noon onwards. The am/pm specifier for Cumulus 1 can use lower, upper, or mixed case, and the result is displayed accordingly.
 
[[File:Badge vMx.png]] For MX, '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".
| {Version badge 1}} 'am' produced by <#LastDataReadT format=am/pm>, 'AM' produced by <#LastDataReadT format=AM/PM>
|-
|h a/p
|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.
 
[[File:Badge v1.png]]The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
 
[[File:Badge vMx.png]]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
|-
|ampm
|(see above for 12 hour formats)
|This 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.
{{Version badge 1}Uses the 12-hour clock for the preceding h or H specifier
| see previous examples
|-
|/
|/
|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. With Cumulus 1, this might not display a colon.
 
[[File:Badge vMx.png]]Note that by default Cumulus MX expects a locale to use ":" for any time separator.
|':' for British locale
|}
 
 
5,838

edits