Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Formatting webtag <#daylightlength>

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
User avatar
krmidas
Posts: 215
Joined: Sat 03 Jul 2010 9:03 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 10
Location: Lake Zurich, IL; USA
Contact:

Formatting webtag <#daylightlength>

Post by krmidas »

The webtag <#daylightlength> returns a value of hh:mm. Is it possible to use any format parameters to separate hours and minutes?

In other words, to be able to show "15 hours, 12 minutes"? I don't think any of the format parameters apply to this situation, but I thought I'd ask.

-Tom
Tom Keramidas, Lake Zurich, IL, USA
Image
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Formatting webtag <#daylightlength>

Post by mcrossley »

Good question, I don't know the answer, but I suspect you are right. I split the time in a little bit of script code to do exactly as you suggest on my home page.
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Formatting webtag <#daylightlength>

Post by mcrossley »

Code: Select all

<script>
var str = '<#daylightlength>'.split(':');
document.write(str[0] + ' hours ' + str[1] + 'minutes');
</script>
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Formatting webtag <#daylightlength>

Post by BCJKiwi »

This in a file named daylenT.txt;
daylen = "<#daylightlength format=hh> hours, <#daylightlength format=m> minutes"
produces this in a file named daylen.txt;
daylen = "10 hours, 12 minutes"

When I have Q's like this myself I just test the options.

Note:- hh or mm will include leading zero where h or m will not.
User avatar
krmidas
Posts: 215
Joined: Sat 03 Jul 2010 9:03 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 10
Location: Lake Zurich, IL; USA
Contact:

Re: Formatting webtag <#daylightlength>

Post by krmidas »

BCJKiwi wrote:This in a file named daylenT.txt;
daylen = "<#daylightlength format=hh> hours, <#daylightlength format=m> minutes"
produces this in a file named daylen.txt;
daylen = "10 hours, 12 minutes"

When I have Q's like this myself I just test the options.

Note:- hh or mm will include leading zero where h or m will not.
I'll give it a try. My assumption was that those format parameters were for the time of day, not elapsed time.
Tom Keramidas, Lake Zurich, IL, USA
Image
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Formatting webtag <#daylightlength>

Post by BCJKiwi »

The daylightlength tag produces a time value.
WIKI says "most time webtags will accept an option 'format' parameter", so, it should not be any different to any other time based tag.
Wiki gives an example;
<#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">

However I have found the tags to be 'picky' when trying to get too complicated or to break up the base output into separate parts in one tag hence using the tag twice in my example.
So as I said, if the first format you try does not work then just try different options until one does.
mm23
Posts: 152
Joined: Mon 03 Feb 2014 12:22 pm
Weather Station: ws 2350
Operating System: windows xp sp3
Location: Europe

Re: Formatting webtag <#daylightlength>

Post by mm23 »

I'm not sure that you can format all of webtags, but try this <#daylightlength format="hh 'hours' , mm 'minutes'">
Image
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Formatting webtag <#daylightlength>

Post by steve »

<#daylightlength> has a format parameter; I don't think there are any date/time web tags currently which don't. Some of them may not work with the full range of formatters (e.g. they may only contain a time and not a date).
Steve
mm23
Posts: 152
Joined: Mon 03 Feb 2014 12:22 pm
Weather Station: ws 2350
Operating System: windows xp sp3
Location: Europe

Re: Formatting webtag <#daylightlength>

Post by mm23 »

OK than.......I've done a lot of formats, and I've never had a problem. I only took into consideration what is written: WIKI says "most time webtags will accept an option 'format' parameter"......
Image
User avatar
krmidas
Posts: 215
Joined: Sat 03 Jul 2010 9:03 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 10
Location: Lake Zurich, IL; USA
Contact:

Re: Formatting webtag <#daylightlength>

Post by krmidas »

Thanks, all.

Using

Code: Select all

<#daylength format=h> hrs <#daylength format=m> min
produced the desired result.

-Tom
Tom Keramidas, Lake Zurich, IL, USA
Image
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Formatting webtag <#daylightlength>

Post by mcrossley »

I should have taken a look at my own code :bash:

Code: Select all

$daylength='<#daylength format="hh'h 'nn'm'">';
$daylightlength='<#daylightlength format="hh'h 'nn'm'">';
User avatar
krmidas
Posts: 215
Joined: Sat 03 Jul 2010 9:03 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 10
Location: Lake Zurich, IL; USA
Contact:

Re: Formatting webtag <#daylightlength>

Post by krmidas »

I've noticed that the values being returned by <#daylength> and <#daylightlength> don't seem to be tracking with the values on the Cumulus screen. See the attached screenshots for today.
Capture1.JPG
Capture2.JPG
Here's the code I'm using to generate the values:
Capture3.JPG
In fact, I don't think the values on my website have changed for those two webtags in the 5 days since I incorporated them. Any ideas?

-Tom
You do not have the required permissions to view the files attached to this post.
Tom Keramidas, Lake Zurich, IL, USA
Image
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Formatting webtag <#daylightlength>

Post by steve »

"n" is the formatter for "minutes", not "m", which is "months", except when it follows an "h" formatter - this is explained in the help. The value used for the web tag only contains a time, which is why the month is not 6, as you might expect.
Steve
User avatar
krmidas
Posts: 215
Joined: Sat 03 Jul 2010 9:03 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows 10
Location: Lake Zurich, IL; USA
Contact:

Re: Formatting webtag <#daylightlength>

Post by krmidas »

Wow, don't know if I would have figured that out.

Thanks, as always! All fixed.
Tom Keramidas, Lake Zurich, IL, USA
Image
Post Reply