11.date PHP PDF
11.date PHP PDF
Date
What is a Timestamp?
A timestamp is the number of seconds since January 1, 1970 at 00:00:00 GMT.
This is also known as the Unix Timestamp.
Date
Format the Date
The first parameter in the date() function specifies how to format the date/time. It uses
letters to represent date and time formats. Here are some of the letters that can be
used:
* d - The day of the month (01-31)
* m - The current month, as a number (01-12)
* Y - The current year in four digits
An overview of all the letters that can be used in the format parameter, can be found in
the W3C PHP Date reference.
Other characters, like"/", ".", or "-" can also be inserted between the letters to add
additional formatting:
Date
Format the Date
Date
Adding a Timestamp
The second parameter in the date() function specifies a timestamp. This parameter is
optional. If you do not supply a timestamp, the current time will be used.
In our next example we will use the time() function to create a timestamp for tomorrow.
The time() function returns the Unix timestamp for NOW.
....but we can manipulate this.
Date
Other Date Functions
We used time() to generate out timestamp, but there are a number of other useful
time/date functions we can use such as strftime() and mktime()
For the full list check the W3C Date/Time Functions List