Working with Date and Time

Being able to work easily with date and time information is one of the most basic skills every PHP programmer should get under their belt as soon as possible, so this is where we will be kicking off.

PHP represents time as the number of seconds that have passed since January 1st 1970 00:00:00 GMT, a date known as the start of the Unix epoch, hence this date format is known as "epoch time" or a "Unix timestamp". This might seem like a peculiar way to store dates, but it is actually remarkably good - internally you can store any date since 1970 as an integer, and convert to a human-readable string wherever necessary.


Next chapter: Reading the current time >>

Previous chapter: Controlling script execution

Jump to:


Home: Table of Contents

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar