Full list of Webtags: Difference between revisions

3,123 bytes removed ,  11:20, 4 October 2022
m
Line 841: Line 841:


=Date & Time=
=Date & Time=
Both Cumulus 1 and MX support all of these, except where marked as MX only, most of these web tags can be used with output parameters.
The default format depends on the locale you use to run Cumulus.
 
When format is fixed it is noted.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 848: Line 851:
|-
|-
|<#date>
|<#date>
|The current date - format depends on locale you use to run Cumulus
|The current date.
|-
|-
|<#metdate>
|<#metdate>
|The current meteorological date. The default format depends on the locale you use to run Cumulus
|The current meteorological date.
*If you use midnight rollover, this returns same date as <#date> (above), but with a different default format.
*If you use midnight rollover, this returns same date as <#date> (above), but with a different default format.
*If using a 9am/10am rollover:
*If using a 9am/10am rollover:
**After rollover time on current calendar date,  this is same as <#date>, but with a different default format.
**After rollover time on current calendar date,  this is same as <#date>, but with a different default format.
**Between midnight and 9am/10am the <#metdate> will return the date associated with previous calendar day, but will still return current time   
**Between midnight and 9am/10am the <#metdate> will return the date associated with previous calendar day, but will still return current time   
Legacy website: Can be used with relevant format parameters to [[Customised templates|customise]] '''todayT.htm''' template page to display current meteorological day, to customise '''thismonthT.htm''' template page to display meteorological month, and to customise '''thisyearT.htm''' template page to display correct meteorological year. This will be particularly useful on first and last day of month/year when rollover happens at 9 (or 10) a.m. and the month (and maybe year) is different before and after rollover.
[[File:Badge vMx.png]] Earlier MX releases provide a similar web template set, so these can be customised in same way as for legacy Cumulus above (but note capital "M" must be used for any month formatting). From release 3.10.1 the supplied web pages are web server based, there are no web templates to customise, and the supplied '''.json files''' do not include any meteorological date functionality.
|-
|-
|<#timeUTC>
|<#timeUTC>
|The current UTC date/time rather than local date/time.  Example result (actual format depends on locale settings): 18:30 on 30 December 2009. If you want the local date and time, use next tag (below).
|The current UTC date/time rather than local date/time.  Example result: 18:30 on 30 December 2009. If you want the local date and time, use next tag (below).
|-
|-
|<#time>
|<#time>
|The current time and date. Example result (actual format depends on locale settings): 18:30 on 30 December 2009.  If you simply wish the time, use next tag (below).
|The current time and date. Example result: 18:30 on 30 December 2009.  If you simply wish the time, use next tag (below).
|-
|-
|<#timehhmmss>
|<#timehhmmss>
Line 880: Line 879:
|-
|-
|<#dayname>
|<#dayname>
| The current day as a word.  For example, Monday (actual format depends on locale settings)
| The current day as a word.  For example, Monday  
|-
|-
|<#shortdayname>
|<#shortdayname>
Line 902: Line 901:
|<#rollovertime>
|<#rollovertime>
|The time that the logs rollover to the next day: 'Midnight', '9 am' or '10 am'
|The time that the logs rollover to the next day: 'Midnight', '9 am' or '10 am'
PHP code example for testing whether before or after rollover given in next entry.
|-
|-
|<#metdateyesterday>
|<#metdateyesterday>
Line 911: Line 908:
**After rollover time on current calendar date,  this is same as <#yesterday> (below), but with a different default format.
**After rollover time on current calendar date,  this is same as <#yesterday> (below), but with a different default format.
**Between midnight and 9am/10am the date output by <#metdateyesterday> will be the calendar day before that returned by <#yesterday>, but the time returned is actual local time.   
**Between midnight and 9am/10am the date output by <#metdateyesterday> will be the calendar day before that returned by <#yesterday>, but the time returned is actual local time.   
Can be used with relevant format parameters to indicate correct day on yesterdayT.htm template page, and can be used to return latest day stored on [[dayfile.txt]] and NOAA report for latest month.
if you use PHP Hypertext preprocessor, you can output different text for before and after rollover, e.g.
<pre><?php
if('<#yesterday format=dddd>' == '<#metdateyesterday format=dddd>') echo '(calendar date and meteorological date same)';
else echo 'rollover still to happen, these results will be treated as belonging to <#metdate format=dddd>';?></pre>
|-
|-
|<#yesterday>
|<#yesterday>
|Yesterday's date.   The default format depends on the locale you use to run Cumulus
|Yesterday's date.  
|-
|-
|<#update>
|<#update>
|The date and time of the last web site update.   The default format depends on the locale you use to run Cumulus
|The date and time of the last web site update.  
|-
|-
|<#timeJavaScript>
|<#timeJavaScript>
| [[File:Badge vMx.png]]Available from version 3.5.2, so not available in legacy software
| The JavaScript '''Date''' object contains the number of milliseconds since 00:00:00.000 UTC on 1st January 1970, that date and time is known as the UNIX Epoch.  In JavaScript, you can use <code>Math.floor(new Date().getTime()/1000.0)</code> This getTime method returns the time in milliseconds.  The web tag returns an integer (currently with 13 digits) representing the number of milliseconds since the UNIX epoch when the web tag was processed. It can be used in a script where you wish to re-express other times output by Cumulus MX into UTC (Coordinated Universal Time).  Mac OS X uses 00:00:00.000 UTC on 1st January 2001 as the starting time and date for its millisecond count, so that is considerably lower.
 
The JavaScript '''Date''' object contains the number of miliseconds since 00:00:00.000 UTC on 1st January 1970, that date and time is known as the UNIX Epoch.  In JavaScript, you can use <tt>Math.floor(new Date().getTime()/1000.0)</tt> This getTime method returns the time in milliseconds.  The web tag returns an integer (currently with 13 digits) representing the number of milliseconds since the UNIX epoch when the web tag was processed. It can be used in a script where you wish to re-express other times output by Cumulus MX into UTC (Coordinated Universal Time).  Mac OS X uses 00:00:00.000 UTC on 1st January 2001 as the starting time and date for its millisecond count, so that is considerably lower.


Note that UTC is calculated using 9192631770 times a particular transition time for Caesium 133 as a basis for 1 second. GMT (Greenwich Mean Time) is calculated on the basis that 1 second is 1/86400 of the time taken for a whole (day) rotation of the Earth. UT1 (or solar time) is calculated from various space measurements. Periodically, leap seconds are added to UTC to realign it with UT1, but these leap seconds are not added to the count of milliseconds represented by this web tag.
Note that UTC is calculated using 9192631770 times a particular transition time for Caesium 133 as a basis for 1 second. GMT (Greenwich Mean Time) is calculated on the basis that 1 second is 1/86400 of the time taken for a whole (day) rotation of the Earth. UT1 (or solar time) is calculated from various space measurements. Periodically, leap seconds are added to UTC to realign it with UT1, but these leap seconds are not added to the count of milliseconds represented by this web tag.
Line 935: Line 923:
|-
|-
|<#timeUnix>
|<#timeUnix>
| [[File:Badge vMx.png]]Available from version 3.7.0, so not available in legacy software
| Unix tracks the number of seconds since the UNIX epoch. So this web tag can be used when you do not want the millisecond accuracy of the previous web tag. Like previous web tag this relates to UTC, so see details for that tag to find out more.
 
Unix tracks the number of seconds since the UNIX epoch. So this web tag can be used when you do not want the millisecond accuracy of the previous web tag. Like previous web tag this relates to UTC, so see details for that tag to find out more. This is equivalent in PHP 5 and PHP 7 to '''time();''' (in PHP 8, a parameter is mandatory for time function, so the call changes).
|-
|-
|<#LastDataReadT>
|<#LastDataReadT>
|The date/time data was last read from the station. Default format for this tag is like this example '''18:30 on 30 December 2009''', but output parameters for both date and time can modify this to include seconds in 1.9.x builds and most MX builds such as per this example  '<#LastDataReadT format="yyyy-MM-dd HH:mm:ss">'.
|The date/time data was last read from the station.  
|-
|-
|<#DaysSince30Dec1899>  
|<#DaysSince30Dec1899>  
Line 946: Line 932:
|-
|-
|<#recordsbegandate>
|<#recordsbegandate>
|Date when records began (appears twice on "recordT.htm" provided in standard web page, and used to calculate next tag, but ignored for all other Cumulus processing). Any output parameters valid for a date can be used here, don't forget differences in modifiers for Cumulus 1 and MX. There is no time associated with this web tag.  The default format is like 30 December 2009, please note although this web tag reports the value associated with  [b]StartDate=dd/MM/yyyy[/b] (see [[Cumulus.ini#Section:_Station]]), the format there is short-date format and different to default format for this web tag.  
|Date when records began.
|-
|-
|<#DaysSinceRecordsBegan>
|<#DaysSinceRecordsBegan>