Webtags (preserving history): Difference between revisions

m
→‎Time/Date 'format' Parameter: Making clear Cumulus 1 only and mentioning Almanac times
m (→‎Davis: storm rain)
m (→‎Time/Date 'format' Parameter: Making clear Cumulus 1 only and mentioning Almanac times)
Line 31: Line 31:
=Time/Date 'format' Parameter=
=Time/Date 'format' Parameter=


From 1.9.1 most time webtags will accept an option 'format' parameter, e.g: <#YearTempHT format=hh:nn>. This allows you to override the default display format for that item, using the format specifiers in the table below. Note that if your format has any spaces in it, you must enclose it in double quotes, thus: <#YearTempHT format="hh nn">.  
From version 1.9.1 most time web-tags will accept an optional 'format' parameter, e.g. (Cumulus 1 only): <#YearTempHT format=hh:nn>.


Although in theory you can specify date formatting to times and vice versa, this will not always yield a sensible result. It is best to look at the default format. For example the time-stamps for today and yesterday only contain time information, so only time-based format instructions should be applied to them.
This allows you to override the default display format for that item, using the format specifiers in the table below.
 
Although, in theory, you can specify date formatting to times, and vice versa, this will not always yield a sensible result. It is best to look at the default format (in most, but not all, cases this reveals whether date and time information are both available):
*The time-stamps for today, and yesterday, only contain time information, so only time-based format instructions should be applied to them. You can use date format parameters on (for example) <#metdate>, and <#metdateyesterday> and that may give you your desired date information to augment the time-stamps.
*Almanac times such as sun-rise, moon-rise, are also only times, and time-based format instructions can generally be applied to them.  However, be aware these are calculated as at midnight GMT and for some of your calendar days, the times may be reported (in default format) as '--' if for example the moon does not rise that day.


'''Differences between Cumulus 1 and Cumulus MX (Cumulus 3):'''
'''Differences between Cumulus 1 and Cumulus MX (Cumulus 3):'''
*Cumulus MX uses the .NET date and time format characters that are not exactly the same as the Delphi ones which Cumulus 1 uses.  For Cumulus MX see [[http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx here for format selectors]]. The differences come about because Delphi is case-insensitive, and .Net is case sensitive, so .Net can use upper and lower case for different items, where Delphi has to use different letters. For example, in Delphi, "nn" means "minutes", and this will need changing to "mm". "hh" in Delphi is the hour in 24-hour format, and in .Net it's "HH".
*Cumulus MX uses the .NET date and time format characters that are not exactly the same as the Delphi ones that Cumulus 1 uses.  For Cumulus MX see [[http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx here for format selectors]]. The differences come about because Delphi is case-insensitive, and .Net is case sensitive, so .Net can use upper and lower case for different items, where Delphi has to use different letters.  
*#For example, in Delphi, "nn" means "minutes" for Cumulus 1, but "minutes" is "mm" for .Net in Cumulus MX.
*# e.g. the hour in 24-hour format, is "hh" in Delphi (Cumulus 1) and in .Net it's "HH" (Cumulus MX).
 
*The other change with the "format" parameter is the different way that .Net escapes characters that are not being used as format specifiers. In Delphi you put the 'verbatim' characters inside single quotes (Cumulus 1); in .Net you escape each verbatim character with backslashes (Cumulus MX).
 
'''The Rest of this section applies only to Cumulus versions 1.9.1 to 1.9.4'''
 
You should put anything that is additional, to the defined format modifier specification below, into single quotation marks to prevent it being interpreted as a date or time format modifier:


*The other change with the "format" parameter is the different way that .Net escapes characters which are not to used as format specifiers. In Delphi you put the 'verbatim' characters inside single quotes; in .Net you escape each verbatim character with backslashes.  
#For example, the word "on" contains the character "n", which will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid syntax: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">.


'''The Rest of this section applies only to Cumulus 1'''
#You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.  Example of valid syntax: <#TapptempH format="'at 'h:nn'&nbsp;'am/pm '&lt;small&gt;on' d/m/yyyy'&lt;/small&gt;'">.


You should put anything which is not intended to be part of the date and time formatting into single quotation marks to prevent it being interpreted as a date or time formatter. For example, the word "on" contains the character "n", which will be interpreted as a time formatter unless you put it into single quotation marks. Example: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">.   You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.  Example: <#TapptempH format="'at 'h:nn'&nbsp;'am/pm '&lt;small&gt;on' d/m/yyyy'&lt;/small&gt;'">.
'''Note that if your format has any spaces in it''', you must enclose the whole format parameter value in double quotes, for example: <#YearTempHT format="hh nn">. Consequently, you cannot include double quote characters in any other position (see [[Php_webtags#Web_tag_Complications| here for work-around]]).


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
!style="width:150px" | Specifier
!style="width:150px" | Delphi Specifier
!style="width:600px" | Displays
!style="width:600px" | Displays
|-
|-
5,838

edits