Author Topic: Saratoga Time/Date Display Issue  (Read 1283 times)

0 Members and 1 Guest are viewing this topic.

Offline RBK

  • Member
  • *
  • Posts: 13
    • Lisle Weather
Saratoga Time/Date Display Issue
« on: November 25, 2017, 12:49:53 PM »
Hi all...

I'm stumped with a time and date display issue using the very nice Saratoga scripts.

I want the time and date to display as Sat Nov-25-2017 1:01pm EST, instead I see 11/25/17  13:01:13. I have the following in settings.php:

$SITE['timeFormat'] = 'D, M-d-Y g:ia T';  // Day, Mar-31-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'] = 'M-d-Y';        // for Mar-31-2008 or 'j/n/Y' for Euro format

Website at: http://lisleweather.com/index.php

Any help is appreciated, thanks!
« Last Edit: November 25, 2017, 01:33:26 PM by RBK »

Offline MackerelSky

  • Contributor
  • ***
  • Posts: 113
    • McKean County Weather, Smethport Pa.
Re: Saratoga Time/Date Display Issue
« Reply #1 on: November 25, 2017, 02:43:08 PM »
Hi all...

I'm stumped with a time and date display issue using the very nice Saratoga scripts.

I want the time and date to display as Sat Nov-25-2017 1:01pm EST, instead I see 11/25/17  13:01:13. I have the following in settings.php:

$SITE['timeFormat'] = 'D, M-d-Y g:ia T';  // Day, Mar-31-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'] = 'M-d-Y';        // for Mar-31-2008 or 'j/n/Y' for Euro format

Website at: http://lisleweather.com/index.php

Any help is appreciated, thanks!

You can try playing with 'ajax-dashboard' around line 44 or so, same type of settings...looks like that one will override Settings.php

Brad
Mckean County Weather
Located on upper Marvin Creek
https://mckeanweather.com/
Davis VP2 + fars
Cumulus 1.9.4-b1092

 

Offline RBK

  • Member
  • *
  • Posts: 13
    • Lisle Weather
Re: Saratoga Time/Date Display Issue
« Reply #2 on: November 25, 2017, 02:57:38 PM »
Thanks for the response Brad...

I have the following in ajax-dashboard.php and the issue remains:

$timeFormat = 'D, M-d-Y g:ia T';  // Fri, Mar-31-2006 6:35pm TZone
//$timeFormat = 'M-d-Y g:ia';  // Mar-31-2006 6:35pm
$timeOnlyFormat = 'g:ia';    // h:mm[am|pm];
//$timeOnlyFormat = 'H:i';     // hh:mm
$dateOnlyFormat = 'M-d-Y';   // Mon-d-YYYY
$WDdateMDY = true;     // true=dates by WD are 'month/day/year'
//                     // false=dates by WD are 'day/month/year'

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Time/Date Display Issue
« Reply #3 on: November 25, 2017, 03:58:20 PM »
Unfortunately, you don't have all choices available for date format since the website displays two dates.  One is from PHP (via the CUtags.php uploaded by Cumulus) -- that one you can format as you wish, but with a caveat...
The second date format is displayed when the ajaxCUwx.js script kicks in and uses the date from realtime.txt for display.

The caveat is that the ajaxCUwx.js script doesn't have formatting capability, and just displays the mm/dd/yyyy or dd/mm/yyyy date based on the setting showDateMDY=true|false in the script.

So.. If you don't want to 'jar' your guests by having the PHP format display, then green-flash and the ajax format display, I suggest you choose mm/dd/yyyy for USA and dd/mm/yyyy for Canada/World in both the PHP and ajax versions.
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 RBK

  • Member
  • *
  • Posts: 13
    • Lisle Weather
Re: Saratoga Time/Date Display Issue
« Reply #4 on: November 25, 2017, 06:02:59 PM »
Thank you for your response, but I'm left not knowing what to do.

Are you saying that because I use Cumulus my date formatting options are limited?

At the very least, I'd like to be able to display time in a 12 hour format, with am and pm indicated.

I'm not understanding why the time format option ($timeFormat = 'D, M-d-Y g:ia T';  // Fri, Mar-31-2006 6:35pm TZone) is offered if it can't be used.

If I run ajax-dashboard.php stand-alone, I see formatting close to what I am after. See image below:

 [ You are not allowed to view attachments ]


On the main page, I see formatting that I do not want. See image below:

 [ You are not allowed to view attachments ]


Thanks for your assistance.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Time/Date Display Issue
« Reply #5 on: November 25, 2017, 06:24:56 PM »
Your examples highlight the two date display methods.  The first is in the native PHP where
Code: [Select]
$timeFormat = 'D, M-d-Y g:ia T'; in the script ajax-dashboard.php itself causes the 'Day, Mon-dd-yyyy hh:mm am/pm TZ' display using the codes for the date() function in PHP (see http://php.net/manual/en/function.date.php for the codes).

The second screenshot shows what happens when the JavaScript ajaxCUwx.js begins execution and replaces the date with the value from realtime.txt uploaded by Cumulus.  That script only provides for two formats: mm/dd/yyyy or dd/mm/yyyy display and that is based on the setting
Code: [Select]
var showDateMDY = true;     // set to false to show date as dd/mm/yy in the ajaxCUwx.js script.  The script doesn't support any other formats at this time.

So, to make the dates appear uniform (both in PHP and in the AJAX-updated displays), you should have Settings.php have
Code: [Select]
$SITE['timeFormat'] = 'm/d/Y g:ia';      // USA  format 03/31/2017 1:03am and ajaxCUwx.js have
Code: [Select]
var showDateMDY = true;     // set to false to show date as dd/mm/yy so the display will show mm/dd/yyyy for the dates.


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 RBK

  • Member
  • *
  • Posts: 13
    • Lisle Weather
Re: Saratoga Time/Date Display Issue
« Reply #6 on: November 25, 2017, 06:59:42 PM »
OK, thanks again for the help.

I'll try what you suggested first thing tomorrow, I'm burned out with this for today.  #-o