Page 1 of 2

ajaxdate

Posted: Thu 15 Aug 2013 6:17 pm
by n9mfk
Hi Ken,
is there a a way to change ajaxdate format from 08/15/13 to 08/15/2013
Thanks Beau

Re: ajaxdate

Posted: Thu 15 Aug 2013 8:23 pm
by BCJKiwi
settings.php

Re: ajaxdate

Posted: Thu 15 Aug 2013 8:25 pm
by William Grimsley
Yes.

Change:

Code: Select all

$SITE['dateOnlyFormat'] = 'd/m/y';        // for 31-Mar-2008 or 'j/n/Y' for Euro format
To:

Code: Select all

$SITE['dateOnlyFormat'] = 'd/m/Y';        // for 31-Mar-2008 or 'j/n/Y' for Euro format
For the PHP.

Then, (still keeping your existing realtime.txt file) create a new realtime.txt file like this.

Code: Select all

<#date format=dd/mm/yyyy> <#timehhmmss> <#temp> <#hum> <#dew> <#wspeed> <#wlatest> <#bearing> <#rrate> <#rfall> <#press> <#currentwdir> <#beaufortnumber> <#windunit> <#tempunitnodeg> <#pressunit> <#rainunit> <#windrun> <#presstrendval> <#rmonth> <#ryear> <#rfallY> <#intemp> <#inhum> <#wchill> <#temptrend> <#tempTH> <#TtempTH> <#tempTL> <#TtempTL> <#windTM> <#TwindTM> <#wgustTM> <#TwgustTM> <#pressTH> <#TpressTH> <#pressTL> <#TpressTL> <#version> <#build> <#wgust> <#heatindex> <#humidex> <#UV> <#ET> <#SolarRad> <#avgbearing> <#rhour> <#forecastnumber> <#isdaylight> <#SensorContactLost> <#wdir> <#cloudbasevalue> <#cloudbaseunit> <#apptemp> <#SunshineHours> <#CurrentSolarMax> <#IsSunny>
Save the new realtime.txt file in the Cumulus 'web' folder and set-up Cumulus to FTP that one instead of using the existing one. First, go to Configuration --> Internet. Then, un-tick the 'Enable Realtime FTP' box. Then, click the 'Files' tab and add in the local filenames field where you saved your new realtime.txt file or click 'Browse...'. Then, add in the remote filenames field 'realtime.txt' and tick all of the 'Process?', 'Realtime?' and 'FTP?' boxes.

Sorry this is a long way to do but it's the only way to achieve and only takes a few minutes,

Hope this helps,

William

Re: ajaxdate

Posted: Thu 15 Aug 2013 8:26 pm
by William Grimsley
BCJKiwi wrote:settings.php
No, that's only for the PHP part of it.

Re: ajaxdate

Posted: Thu 15 Aug 2013 8:42 pm
by BCJKiwi
Yes, I was a little quick on the draw.
ajaxCUwx.js picks up realtime[0] so unless you want to use a different format from what is in the PC Cumulus is using, you should not need to change anything.
Perhaps the time format is not right in the Cumulus PC?

Re: ajaxdate

Posted: Thu 15 Aug 2013 10:13 pm
by n9mfk
Hi All,
not sure what happened to that post

pc year set to full year 2013 that what im look for in the ajax


thanks Beau

Re: ajaxdate

Posted: Thu 15 Aug 2013 11:07 pm
by BCJKiwi
Beau,
That's a bit cryptic.
Do you mean you want the full year 1/2/2013 instead of 1/2/13?
If so, there is a lot of this century to go so maybe in ajaxCUwx.js you could just add 20 on to the front of the year ;)

Re: ajaxdate

Posted: Fri 16 Aug 2013 6:52 am
by William Grimsley
BCJKiwi wrote:Beau,
That's a bit cryptic.
Do you mean you want the full year 1/2/2013 instead of 1/2/13?
If so, there is a lot of this century to go so maybe in ajaxCUwx.js you could just add 20 on to the front of the year ;)
If Beau uses my method he will be able to achieve what he wants.

Re: ajaxdate

Posted: Fri 16 Aug 2013 5:19 pm
by gluepack
well, except for the fact that he wants it m/d/y format.

Re: ajaxdate

Posted: Fri 16 Aug 2013 5:28 pm
by William Grimsley
gluepack wrote:well, except for the fact that he wants it m/d/y format.
Ok, then he would just do this.

Change:

Code: Select all

$SITE['dateOnlyFormat'] = 'd/m/Y';        // for 31-Mar-2008 or 'j/n/Y' for Euro format
To:

Code: Select all

$SITE['dateOnlyFormat'] = 'm/d/Y';        // for 31-Mar-2008 or 'j/n/Y' for Euro format
And:

Change:

Code: Select all

<#date format=dd/mm/yyyy> <#timehhmmss> <#temp> <#hum> <#dew> <#wspeed> <#wlatest> <#bearing> <#rrate> <#rfall> <#press> <#currentwdir> <#beaufortnumber> <#windunit> <#tempunitnodeg> <#pressunit> <#rainunit> <#windrun> <#presstrendval> <#rmonth> <#ryear> <#rfallY> <#intemp> <#inhum> <#wchill> <#temptrend> <#tempTH> <#TtempTH> <#tempTL> <#TtempTL> <#windTM> <#TwindTM> <#wgustTM> <#TwgustTM> <#pressTH> <#TpressTH> <#pressTL> <#TpressTL> <#version> <#build> <#wgust> <#heatindex> <#humidex> <#UV> <#ET> <#SolarRad> <#avgbearing> <#rhour> <#forecastnumber> <#isdaylight> <#SensorContactLost> <#wdir> <#cloudbasevalue> <#cloudbaseunit> <#apptemp> <#SunshineHours> <#CurrentSolarMax> <#IsSunny>
To:

Code: Select all

<#date format=mm/dd/yyyy> <#timehhmmss> <#temp> <#hum> <#dew> <#wspeed> <#wlatest> <#bearing> <#rrate> <#rfall> <#press> <#currentwdir> <#beaufortnumber> <#windunit> <#tempunitnodeg> <#pressunit> <#rainunit> <#windrun> <#presstrendval> <#rmonth> <#ryear> <#rfallY> <#intemp> <#inhum> <#wchill> <#temptrend> <#tempTH> <#TtempTH> <#tempTL> <#TtempTL> <#windTM> <#TwindTM> <#wgustTM> <#TwgustTM> <#pressTH> <#TpressTH> <#pressTL> <#TpressTL> <#version> <#build> <#wgust> <#heatindex> <#humidex> <#UV> <#ET> <#SolarRad> <#avgbearing> <#rhour> <#forecastnumber> <#isdaylight> <#SensorContactLost> <#wdir> <#cloudbasevalue> <#cloudbaseunit> <#apptemp> <#SunshineHours> <#CurrentSolarMax> <#IsSunny>

Re: ajaxdate

Posted: Sat 17 Aug 2013 2:05 am
by gemini06720
n9mfk wrote:is there a a way to change ajaxdate format from 08/15/13 to 08/15/2013
Not an easy way, unfortunately.

The AJAX 'ajaxCUwx.js' JavaScript gets its date from the 'realtime.txt' near real time data file - according to the Wiki documentation for the Cumulus produced 'realtime.txt' data file, the data format is always 'dd/mm/yy' (ie: date number/month number/year number).

Looking at the source code of 'ajaxCUwx.js' (starting at line #898), no processing and no modification is done to the date - it is just displayed as it is read, as it is produced by Cumulus.

The only way to get a different date format would be to add some lines of code to the 'ajaxCUwx.js' JavaScript, lines that would extract the individual components of the date (ie: the date number, the month number and the year number) and convert those individual components into a more 'human readable' date display.

Oh, by the way, all other suggestions can easily be used with PHP scripts but not as easily with an AJAX script.... ;)

Re: ajaxdate

Posted: Sat 17 Aug 2013 7:54 am
by William Grimsley
gemini06720 wrote:
n9mfk wrote:is there a a way to change ajaxdate format from 08/15/13 to 08/15/2013
Not an easy way, unfortunately.

The AJAX 'ajaxCUwx.js' JavaScript gets its date from the 'realtime.txt' near real time data file - according to the Wiki documentation for the Cumulus produced 'realtime.txt' data file, the data format is always 'dd/mm/yy' (ie: date number/month number/year number).

Looking at the source code of 'ajaxCUwx.js' (starting at line #898), no processing and no modification is done to the date - it is just displayed as it is read, as it is produced by Cumulus.

The only way to get a different date format would be to add some lines of code to the 'ajaxCUwx.js' JavaScript, lines that would extract the individual components of the date (ie: the date number, the month number and the year number) and convert those individual components into a more 'human readable' date display.

Oh, by the way, all other suggestions can easily be used with PHP scripts but not as easily with an AJAX script.... ;)
Yes, but if you just created a new realtime.txt file with the web tags like I've done above and change to what I've changed above. Then, surely that will work.

Re: ajaxdate

Posted: Sat 17 Aug 2013 8:29 am
by gemini06720
William Grimsley wrote:...but if you just created a new realtime.txt file with the web tags like I've done above and change to what I've changed above. Then, surely that will work.
William, your solution is good but it is, in my view, just a 'band aid' solution - it does not correct the limitation of the AJAX 'ajaxCUwx.js' JavaScript.

Re: ajaxdate

Posted: Sat 17 Aug 2013 2:15 pm
by William Grimsley
gemini06720 wrote:
William Grimsley wrote:...but if you just created a new realtime.txt file with the web tags like I've done above and change to what I've changed above. Then, surely that will work.
William, your solution is good but it is, in my view, just a 'band aid' solution - it does not correct the limitation of the AJAX 'ajaxCUwx.js' JavaScript.
It saves a lot of hastle though.

Re: ajaxdate

Posted: Sat 17 Aug 2013 9:27 pm
by gluepack
And Band-Aids are designed to last a lot longer nowadays. Invariably they have to ;)