Log in

View Full Version : php date(1) function



autofocus
11-24-2009, 03:33 AM
Hi
i came across this code in an application


$jd = cal_to_jd(CAL_GREGORIAN, $thismonth, date(1), $thisyear);


what is the purpose of date(1) ? i checked php manual but could not find why there is an integer. most of the time i have used date('Y') or date('m') or other similar usages where i always passed some kind of format as string.

thanks

djr33
11-24-2009, 06:50 AM
I have no idea what that is doing. The parameters for date() are specific characters that display parts of the current time (like d= day, etc), and any other characters are just output in the string. As far as I know, that would just (always) display '1'. Technically that is not incorrect PHP, but just useless.
Then again, run the code and see what you get. There's no documentation about numerical values on php.net, though.

The only other thing that comes to mind is a strange typo from 'l' as the characters look alike (1/l), but that seems unlikely. "l" would give "A full textual representation of the day of the week".


Since there appears to be no other way to understand it (easily, anyway), I suggest that you instead try to figure out what $jd is, and why it holds such values-- then you can determine what is going on with date(1).