Can't get accurate day of year

From: Date: Sat, 05 Jan 2002 22:31:32 +0000
Subject: Can't get accurate day of year
Groups: php.general 
Request: Send a blank email to php-general+get-79579@lists.php.net to get a copy of this message
Hello All and Happy New Year. I have a simple routine to get the year, date and the day of year. Year and date come out correctly but the day of year is one less than the date. It being January, it's easy to see the error. The only thing I can figure, is that the date(z) function gets a fractional value and rounds down not rounds up. I really could use some input on this before I just add one to the result and move on. Thanks, Hugh $date_array=getdate(); / / gets today's date info foreach ($date_array as $key=>$val) { $key=$val; } $current_year=$date_array[year]; / / returns 2002 $std_date=date("n-j-y"); / / returns 1-5-02 $day_of_year=date(z); / / returns 4 !!

« previous php.general (#79579) next »