# Re: [PHP] Problem with date

```Adding the number of seconds in a day could fall in the same day due
to daylight saving time, a more reliable way of adding one day (or a
given number of days) is this:```
```
\$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));

Then use date() with \$tomorrow to format it.

(Taken from example #3 here:
http://www.php.net/manual/en/function.date.php, see the Note below the
example in that page).

Hope that helps.

Regards,
Jonathan

2009/9/15 Korgan <josber...@seznam.cz>:
> Hi,
>
>  I have a problem with date function.
>
> \$gen_pos = mktime(0,0,1,10,25,2009);
> \$d1 = date("Y-m-d", \$gen_pos);                // 2009-10-25
> \$d2 = date("Y-m-d", \$gen_pos + (1*24*60*60)); // 2009-10-25
> \$d3 = date("Y-m-d", \$gen_pos + (2*24*60*60)); // 2009-10-26
> \$d4 = date("Y-m-d", \$gen_pos + (3*24*60*60)); // 2009-10-27
> \$d5 = date("Y-m-d", \$gen_pos + (4*24*60*60));
> \$d6 = date("Y-m-d", \$gen_pos + (5*24*60*60));
> \$d7 = date("Y-m-d", \$gen_pos + (6*24*60*60));
> \$d8 = date("Y-m-d", \$gen_pos + (7*24*60*60));
>
> line 2 and line 3 return same date,its wrong ... it should be 2009-10-25 ,
> 2009-10-26 ? :)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

```