25998Working with dates and times in PHPhttp://codewalkers.com/tutorials.php?show=29Let?s discuss dates and times and how we use them in PHP projects. The date and time functions allow you to use the time of the server that PHP is running on so keep in mind that this function will depend on the local setting of your server.PHP > Tips and Tutorials > Date and TimeOct 15, 2006
First of all try to collect the necessary information which are important to display the actual month and highlight the actual day. Besides this we want to display the actual month and year informations as well. To do this we need 3 special days informations:
The actual day
The first day of the actual month
The last day of the actual month
The epoche value that can be determined by time() and other PHP functions can be used to easily calculate the difference between two dates. The trick is to convert the dates into time stamps (if not already available in this format).
This code is for when you have a list of events you would like to put on a Web page but don't want to have to keep track of which events have expired and manually delete them. The code will check the date of each event and only display the events that are of the current day or forward. Even if you don't have use for this particular script, you will see how you can use the date format to compare today's date to other dates.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.