O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time and Date

All the time functions work off the UNIX epoch, which is January 1, 1970. Dates are expressed as seconds since the epoch. This makes it easy to refer to dates with integers. When a function calls for seconds since the epoch, I've referred to it as a timestamp.

boolean checkdate(integer month, integer day, integer year)

The checkdate function returns TRUE if a date is valid, FALSE otherwise. A day is considered valid if the year is between 0 and 32,767, the month is between 1 and 12, and lastly, if the day is within the allowable days for that month.

<?
     if(checkdate(2,18,1970))
     {
          print("It is a good day");
     }
?>

string date(string format, integer timestamp)

The date function returns a string describing the date of the timestamp ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required