WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: Andy G on January 20, 2022, 08:46:32 AM

Title: Sunrise Sunset Times Wrong in wxastronomy.php
Post by: Andy G on January 20, 2022, 08:46:32 AM
Hello

After a few year break (not in prison 8-)) from my website http://www.sunprairieweather.com/index.php (http://www.sunprairieweather.com/index.php) I have decided to revive it. I am mostly starting from scratch as the old one turned into a bit of a mess, with many broken pages ect. So I plan to have a little less this time. Easier to maintain and keep things working and have the base template working correctly before customizing. My first problem is on my wxastronomy.php page http://www.sunprairieweather.com/wxastronomy.php (http://www.sunprairieweather.com/wxastronomy.php) the times are not correct. Looking for some help before I move on.

Thank You Andy
Title: Re: Sunrise Sunset Times Wrong in wxastronomy.php
Post by: Daali on January 20, 2022, 09:21:21 AM
looking at the code, someone with more knowledge will need to see some of your settings.php and possibly common.php to figure out what is happening.

not your site code, but the version I found in git
Code: [Select]
NOTE: you don't have to change these defaults.. use Settings.php to set your values.
$timeFormat = 'd-M-Y g:ia';  // 31-Mar-2006 6:35pm
//$timeFormat = 'd-M-Y H:i';   // 31-Mar-2006 18:35
$timeOnlyFormat = 'g:ia';    // h:mm[am|pm];
//$timeOnlyFormat = 'H:i';     // hh:mm
$dateOnlyFormat = 'd-M-Y';   // d-Mon-YYYY
$WDdateMDY = true;     // true=dates by WD are 'month/day/year'
//                     // false=dates by WD are 'day/month/year'
$ourTZ = "PST8PDT";  //NOTE: this *MUST* be set correctly to
// translate UTC times to your LOCAL time for the displays.
Title: Re: Sunrise Sunset Times Wrong in wxastronomy.php
Post by: saratogaWX on January 20, 2022, 12:34:21 PM
Looking at your testtags.php?sce=view shows
Code: [Select]
$stationlatitude =  '   :  :  ';    // Latitude (from the sun moon rise/set setup)
$stationlongitude =  '    :  :  ';    // Longtitude (from the sun moon rise/set setup)
which shows you've not entered your latitude and longitude into WD so it thinks you're at 0,0 .

Use Weather-Display, Control Panel, Sun/Lunar Coordinates TAB

Enter your latitude and longitude there.  NOTE:  don't use a - (minus) sign for Longitude.  The Longitude is astronomical (+ = WEST of GMT), not terrestrial (- = WEST of GMT).

For example, my station here in Saratoga, CA, USA has
Code: [Select]
$stationlatitude =  '037:16:28'; // Latitude (from the sun moon rise/set setup)
$stationlongitude =  '0122:01:23'; // Longtitude (from the sun moon rise/set setup)
  (notice the 122 is NOT -122.

Then WD should correctly compute sun/moon rise/set info for you.
Title: Re: Sunrise Sunset Times Wrong in wxastronomy.php
Post by: Andy G on January 20, 2022, 01:17:46 PM
Thank you so much ken. I see you are still the backbone of this whole operation. Tried to get alyajaxboard6 working had two errors, will try to find an answer before posting. Thanks again.

Andy
Title: Re: Sunrise Sunset Times Wrong in wxastronomy.php
Post by: saratogaWX on January 20, 2022, 03:31:21 PM
I'll be working through the alt-dashboard issues with PHP 8.1 soon.. going through the basic template scripts first.