|
|
|
> Is there an easy way to get get date of "today+x days"?
>
> I thought of date("z") - day of the year. But how do I get the date if I
> know the date of the year. I couldn't figure out a function for that
> purpose.
Sure, easy. This little example will give you the date 40 days from now:
<?
list($hour, $min, $sec, $day, $mon, $yr) = explode(" ",date("H i s d m y"));
echo date("M d/y",mktime($hour, $min, $sec, $mon, $day + 40, $yr));
?>
The nice thing about doing it this way is that it should correctly handle
weird things like daylight savings time changes, leap years, leap seconds,
etc.
|
|
| A Timing Class Categories : PHP, PHP Classes, Date Time | | | Finding the day of the week for a specific date.
Categories : PHP, Databases, MySQL, Date Time | | | A wrapper function to format dates coming from a databases with the
same syntax as PHP's date() function. Categories : Date Time, Databases, PHP | | | pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes | | | A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function. Categories : PHP, PHP Classes, Calendar, Date Time | | | PHP Round Clock - Must have Gif support to use this. Categories : PHP, Date Time, Graphics | | | A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time, PHP, Complete Programs, Calendar | | | Open and Close your website in fixed times . Categories : PHP, PHP Classes, Cron, Date Time | | | mysql date/time converters Categories : PHP, MySQL, Databases, Date Time | | | Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used. Categories : HTML and PHP, PHP, Date Time | | | If you want to create select buttons featuring current date this example will show you how... Categories : Date Time, HTML and PHP, PHP | | | Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example. Categories : PHP, Date Time, PHP Classes, Calendar | | | calculus of the eastersunday Categories : BC math, PHP, Date Time, Databases | | | Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June). Categories : Calendar, Date Time, PHP | | | Monthly and Daily Upcoming Events calendar. Categories : Date Time, PostgreSQL, PHP, Calendar, Databases | |
| | | | Darius Kurgan wrote : 325
It don`t work..
PHP4 say: Warning: unexpected error in date() in ...
2000.04.15. Result on PHP3 : Jan 01/70
Dariuz
| | | | horacio Degiorgi wrote :382
change y by Y and it works
(y2k bug)
| |
|
|
|