Page 1 of 1

Web Tag <DaysSince30Dec1899>

Posted: Fri 08 Nov 2019 5:59 pm
by krmidas
Has anyone had success with the web tag <DaysSince30Dec1899> (replacing 30Dec1899 with their own date)? I've tried it and it doesn't deliver a value. My date is 18 June 2005. I've tried "Jun" as well as "June". Neither worked.

-Tom

Re: Web Tag <DaysSince30Dec1899>

Posted: Fri 08 Nov 2019 7:05 pm
by mcrossley
You can't change the date, the tag is <#DaysSince30Dec1899> the calendar base date, you cannot specify an arbitrary date.

Re: Web Tag <DaysSince30Dec1899>

Posted: Fri 08 Nov 2019 11:52 pm
by krmidas
I wish there was a tag to indicate the station age (in days), which in my case is greater than the number of days I've been using Cumulus.

Re: Web Tag <DaysSince30Dec1899>

Posted: Sat 09 Nov 2019 5:07 am
by beteljuice
You could always use some javascript or php ;)

Re: Web Tag <DaysSince30Dec1899>

Posted: Sat 09 Nov 2019 9:55 am
by RayProudfoot
krmidas wrote: Fri 08 Nov 2019 11:52 pm I wish there was a tag to indicate the station age (in days), which in my case is greater than the number of days I've been using Cumulus.
I've been using <#DaysSinceRecordsBegan> for ages. That sounds like it would suit your needs. Visible in a grey banner on my site: http://www.cheadlehulmeweather.co.uk/

Re: Web Tag <DaysSince30Dec1899>

Posted: Sat 09 Nov 2019 1:46 pm
by beteljuice
<#DaysSinceRecordsBegan> ...
... which in my case is greater than the number of days I've been using Cumulus
Javascript is very unfriendly with date and time, but this will do what you want:

Code: Select all

<span id="since"></span> days of records<br/>

<script>
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!
    var yyyy = today.getFullYear();
    if(dd<10) {
    dd='0'+dd
    }
    if(mm<10) {
    mm='0'+mm
    }
    today = yyyy+'/'+mm+'/'+dd;
	
    fromdate = "2006/01/08"; // enter your from date yyyy/mm/dd
	
    var date2 = new Date(today);
    var date1 = new Date(fromdate);
    var timeDiff = Math.abs(date2.getTime() - date1.getTime());
    var dayDifference = Math.ceil(timeDiff / (1000 * 3600 * 24));
    document.getElementById("since").innerHTML = dayDifference;
</script>
Note: The <script> must be somewhere below the <span> else it can't 'see' it.

... and yes I tested it ;)

Re: Web Tag <DaysSince30Dec1899>

Posted: Fri 29 Nov 2019 3:36 pm
by krmidas
That script worked for me! Thanks!