n9mfk wrote:hi Ken im tring to learn
what did i miss on this url
aa.usno.navy.mil,cgi-bin/aa_pap.pl/FFX=2&ID=AA&xxy=2011&xxm=3&xxd=15&place=Springfield%2C+IL%2C+USA&xx0=-1&xx1=89&xx2=37&yy0=1&yy1=39&yy2=42&zz1=5&zz0=-1&ZZZ=END
thanks Beau
Beau,
That URL is constructed by the get-USNO-sunmoon.php getUSNOsunmoon() function. The USNO (unlike most other sites) only accepts a POST query to it's website.. a GET query with that string will not work. The function getUSNOsunmoon() does the assembly of the correct arguments and a POST query to aa.usno.navy.mil for the data and parses the results and returns the data in an array for use by the programs.
gemini06720 wrote:kinder wrote:limitation of strotime.Handle dates with / in m/d/y format.probably thats the reason.
The 'strtotime' function is supposed to (as written in the documentation) "...parse about any English textual datetime description into a Unix time...".
I guess having the date in the 'dd/mm/yyyy' format (as '16/03/2011') is not one of the formats accepted by the function...

gemini06720 wrote:saratogaWX wrote:Also, check your Settings.php entry for
that instructs the date functions to process the dates from Cumulus as M/D/Y (for =true) or as D/M/Y (for =false) .. if it's set incorrectly, all bets are off
Ken, just to be sure I understand clearly the purposes/results of the '$SITE['WDdateMDY']' variable:
- true=dates are in the 'month/day/year' format
false=dates are in the 'day/month/year' format
You also mentioned
saratogaWX wrote:...Ah, yes... it's that 'PHP is confused by European-style-dates' issue...
Is PHP not a global project with people from almost every countries of the world participating - why would one PHP function not be able to handle the European-style date formats without having to go through additional setups...

Ray, yes, PHP is an international project, and it
does handle multiple date formats, but by default, it's format is USA-style dates (mm/dd/yyyy) and only a setlocale() can change that default. As I'd posted before, the arguments for setlocale() are
not really standardized across the various platforms hosting PHP, and the strings even differ amongst different distributions of Linux/Unix, so I'd not directly incorporated that into the template sets .. instead, I'd tried to accomodate mm/dd/yyyy v.s. dd/mm/yyyy (and dd-mm-yyyy and dd.mm.yyyy) by using functions in the various scripts to take the date given by the weather software, and compose a yyyy-mm-dd hh:mm string that strtotime() could correctly parse into a unix timestamp based on the default US-English format for the dates in the majority of PHP installations. The key is to set $SITE['WDdateMDY'] to help the functions determine which format to use when assembling the strtotime() argument in US-English format.
beteljuice wrote:Note:
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
To avoid potential ambiguity, it's best to use ISO 8601 (YYYY-MM-DD) dates or DateTime::createFromFormat() when possible.
Link:
strtotime() function
Beteljuice,
Weather-Display uses m/d/y or d/m/y for the dates (based on the WD setting), and even Cumulus will use the / format for either m/d/y or d/m/y based on the local PC setting. I agree that the ISO 8601 format is best and always non-ambiguous, but not all the weather software produce dates in that format, so we just try to adapt as best we can
Best regards,
Ken