Date and Time Functions
Changing the direction of the chapter just a bit, I’ll introduce a couple of PHP’s date- and time-related functions. The most important of these is the aptly named date() function, which returns a string of text for a certain date and time according to a format you specify.
date ('format', [timestamp]);
The timestamp is an optional argument representing the number of seconds since the Unix Epoch (midnight on January 1, 1970) for the date in question. It allows you to get information, like the day of the week, for a particular date. If a timestamp is not specified, PHP will just use the current time on the server.
There are myriad formatting parameters available (Table 3.1), and these can be used in conjunction with literal ...
Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.