![]() |
|||||||||||||||||||||||||
| Home --- Topics --- Articles --- Offers --- Register --- Contact us | |||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
|
Did you know? if you register at Hamid School you can save up to 45% on hosting packages offered by Surreyhost.com . Don't miss out, every minute counts! Are you Confused? Click here to learn how to use hamid school PHP DateThe PHP date() function is used to format a time or a date. The PHP Date() FunctionThe PHP date() function formats a timestamp to a more readable date and time. Syntax
PHP 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. PHP Date - Format the DateThe 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:
Other characters, like"/", ".", or "-" can also be inserted between the letters to add additional formatting:
The output of the code above could be something like this:
PHP Date - Adding a TimestampThe 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 mktime() function to create a timestamp for tomorrow. The mktime() function returns the Unix timestamp for a specified date. Syntax
To go one day in the future we simply add one to the day argument of mktime():
The output of the code above could be something like this:
Viewed:522 Original Author: W3school however, some changes have been made to the main contents.
Did you know? if you register at Hamid School you can learn web programming and designing for free and also you can save up to 45% on hosting packages offered by Surreyhost.com . Don't miss out, every minute counts!
|
|
||||||||||||||||||||||||
|
Sponsored by: Surreyhost.com Coded and designed by: Hamid Moudi HPLA Follow us: ![]() ![]() |
|||||||||||||||||||||||||