5,838
edits
m (→Davis: added ref.) |
|||
|
=Time/Date 'format' Parameter=
Time/Date format codes are used in two places:
# As part of report names for NOAA style reports (see [[Cumulus.ini#Section:_NOAA]])
From version 1.9.1 most time web-tags will accept an optional 'format' parameter, e.g. (Cumulus 1 only): <#YearTempHT format=hh:nn>.▼
# As part of web-tags that report either times or dates or both a date and a time
▲From version 1.9.1 most
This allows you to override the default display format for that item, using the format specifiers in the table below.
*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.
== Additional text ==
'''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 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).▼
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 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). ▼
#For example, the word "on" contains the character "n", which for Cumulus versions 1.9.1 to 1.9.4 will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid Cumulus 1 syntax: <#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.<br> Example of valid syntax: <#TapptempH format="'at 'h:nn' 'am/pm '<small>on' d/m/yyyy'</small>'">.▼
'''Note
▲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:
▲#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">.
▲*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
▲*#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).
▲#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' 'am/pm '<small>on' d/m/yyyy'</small>'">.
For full details see [http://sandaysoft.com/forum/viewtopic.php?f=27&t=12908 Cumulus MX forum], the following table is abridged.
== List of allowed modifiers ==
▲'''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"
|-
!style="width:150px" | Delphi Specifier for Cumulus 1.9.x
!style="width:150px" | .NET Specifier for Cumulus MX
!style="width:600px" | Displays
|-
|c
|G
|Displays the date using the format given by the Windows Short Date format, followed by the time using the format given by the Windows Long Time format. The time is not displayed in Cumulus 1 if the date-time value indicates midnight precisely.
|-
|d
|d (with other modifiers)
|Displays the day as a number without a leading zero (1-31).
|-
|dd
|dd
|Displays the day as a number with a leading zero (01-31).
|-
|ddd
|ddd
|Displays the day as an abbreviation (Sun-Sat) using the strings appropriate to the Windows Locale.
|-
|dddd
|dddd
|Displays the day as a full name (Sunday-Saturday) using the strings appropriate to the Windows Locale.
|-
|ddddd
|d (as single character format)
|Displays the date using the format given by the Windows Short Date format.
|-
|dddddd
|D
|Displays the date using the format given by the Windows Long Date format.
|-
|m
|M
|Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
|-
|mm
|MM
|Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
|-
|mmm
|MMM
|Displays the month as an abbreviation (Jan-Dec) using the strings appropriate to the Windows Locale.
|-
|mmmm
|MMMM
|Displays the month as a full name (January-December) using the strings appropriate to the Windows Locale.
|-
|yy
|yy
|Displays the year as a two-digit number (00-99).
|-
|yyyy
|yyyy
|Displays the year as a four-digit number (0000-9999).
|-
|(not available)
|h
|Displays the hour (12 hour clock) without a leading zero (
|-
|h
|H
|-
|(not available)
|hh
|Displays the hour (12 hour clock) with a leading zero (
|-
|hh
|HH
|Displays the hour using 24 hour clock with a leading zero (00-23).
|-
|n
|m
|Displays the minute without a leading zero (0-59).
|-
|nn
|mm
|Displays the minute with a leading zero (00-59).
|-
|s
|s
|Displays the second without a leading zero (0-59).
|-
|ss
|ss
|Displays the second with a leading zero (00-59).
|-
|z
|(not available)
▲|Displays the millisecond without a leading zero (0-999).
|Displays the millisecond without a leading zero (0-999).
|-
|(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).
|-
|t
|t
|Displays the time using the
|-
|tt
|T
|Displays the time using the
|-
|am/pm
|tt
|Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
|-
|a/p
|t
|Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
|-
|ampm
|
|Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the Windows AM string for any hour before noon, and the contents of the Windows PM string for any hour after noon.
|-
|/
|/
|Displays the date separator character given by the Windows Date Separator.
|-
|:
|:
|Displays the time separator character given by the Windows Time Separator.
|-
|'xx'
|'xx'
|Characters enclosed in single quotation marks are displayed as such, and do not affect formatting.
| |||
edits