Author Topic: saratoga template - issues with date format  (Read 966 times)

0 Members and 1 Guest are viewing this topic.

Offline jmwarren21

  • Member
  • *
  • Posts: 5
    • myweatherstations.com
saratoga template - issues with date format
« on: February 18, 2017, 11:33:01 AM »
I am setting up a website using the saratoga-weather template.  I am having trouble getting the date formatted correctly.  I have searched the forum, but so far, I have been unable to fix the issue.

My site is at http://myweatherstations.com/ 

The date shows 18/2/2017, I want it to be Feb 18, 2017.  I am using WD and the latest version of the saratoga template.  Any assistance you could provide would be appreciated.

Thanks,
Jason

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: saratoga template - issues with date format
« Reply #1 on: February 18, 2017, 12:03:11 PM »
What date/time format did you specify in the Settings.php?

Offline jmwarren21

  • Member
  • *
  • Posts: 5
    • myweatherstations.com
Re: saratoga template - issues with date format
« Reply #2 on: February 18, 2017, 12:21:55 PM »
Here is the code from my settings.php file...



$SITE['timeFormat'] = 'D, d-M-Y g:ia T';  // Day, 31-Mar-2006 6:35pm Tz  (USA Style)
//$SITE['timeFormat'] = 'm/d/Y g:ia';      // USA  format 03/31/2006 14:03
//$SITE['timeFormat'] = 'd/m/Y H:i';       // Euro format 31/03/2006 14:03
//$SITE['timeFormat'] = 'Y-m-d H:i';       // ISO  format 2006-03-31 14:03

$SITE['timeOnlyFormat'] = 'g:ia';          // USA format h:mm[am|pm\
//$SITE['timeOnlyFormat'] = 'H:i';          // Euro format hh:mm  (hh=00..23);
$SITE['dateOnlyFormat'] = 'd-M-Y';        // for 31-Mar-2008 or 'j/n/Y' for Euro format

$SITE['WDdateMDY'] = false; // for WD date format of month/day/year.  =false for day/month/year

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: saratoga template - issues with date format
« Reply #3 on: February 18, 2017, 12:37:02 PM »
Looking at your HTML, the format for date you have specified in the setting is
$SITE['dateOnlyFormat'] = 'd-M-Y';

and this is indeed in the HTML of the page, however as soon as the page updates for the first time it changes to d/m/Y

I checked the JS and it looks like it is taking the date format directly from your clientraw.txt, which has d/m/Y

See if this can be changed in WD or Im afraid we will have to wait for the expert (Ken) :-) Sorry, I dont use Saratoga myself.


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template - issues with date format
« Reply #4 on: February 18, 2017, 12:47:04 PM »
There are two paths to have the date/time set.  The first is the PHP page and the Settings.php control the format of the date/time.
When the AJAX script (ajaxWDwx.js for Weather-Display) starts executing, it takes the date/time from clientraw.txt and does not reformat it.. just displays the 'raw' data based on your Weather-Display settings.  In WD, Control Panel, Units&OtherSettings, Precision/Time/Date/Cloud Height TAB you only have two choices for the WebPage/WebCam date format:  month/day/year or day/month/year.  Change that to month/day/year and it will show the USA format for the date.

I suggest you also change Settings.php date/time specs to use month/day/year instead of day-Mon-year format so they will match what WD will display throughout the rest of the site.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jmwarren21

  • Member
  • *
  • Posts: 5
    • myweatherstations.com
Re: saratoga template - issues with date format
« Reply #5 on: February 18, 2017, 12:52:51 PM »
That did it.  Thank you both so much for your help!

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: saratoga template - issues with date format
« Reply #6 on: February 18, 2017, 12:57:56 PM »
Don't forget to change Settings.php
Code: [Select]
$SITE['WDdateMDY'] = false; // for WD date format of month/day/year.  =false for day/month/year
to
Code: [Select]
$SITE['WDdateMDY'] = true; // for WD date format of month/day/year.  =false for day/month/year
now that you've switched WD to use month/day/year format for the webpages.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP