e you need to avoid unusual behavior.
The mktime function is unusual in that indexes for months start at 1 and not 0
as you might expect, but it does indicate that on the manual pages.
Thanks,
Ash
http://www.ashleysheridan.co.uk
- Reply message -
From: "Jason Pruim"
Date: Sat,
On Sat, Oct 16, 2010 at 11:12:03AM -0400, Jason Pruim wrote:
> Okay so I'm just playing around with some stuff trying to learn more
> and expand my knowledge and I ran into something I don't
> understand... Take the following code:
>
>
> echo "";
> $i ="0";
> while($i <="12") {
>
> $dat
This is because of your mktime() call. You're trying to get the zeroth day of
the month, which is the last day of the preceding month. Using mktime(0, 0, 0,
$i, 1) instead should give you the desired results, assuming you do start at 1,
and not 0 as you have in your code.
---
Simon Welsh
On 17/
Okay so I'm just playing around with some stuff trying to learn more
and expand my knowledge and I ran into something I don't understand...
Take the following code:
";
$i ="0";
while($i <="12") {
$dateformat = date("M", mktime(0,0,0, $i,0,0));
$month = mktime(0,0,0, $i,0,0);
4 matches
Mail list logo