In the previous tutorial, you have learned the basic knowledge about PHP. I guess you all have mastered the previous tutorial so we can easily move on to the advanced tutorial. In the next tutorial, you will learn more details about PHP functions to make your system more compatible, reliable, and more interested. So, here we go!
date() Function
Syntax:
Here is the description:
- format - specifies the format of the timestamp (required).
- timestamp - specifies a timestamp. Default is the current date and time (optional).
Format the Date
Here are some description about the character we will used:
- d - represents the day of the month (01-31).
- m - represents a month (01-12).
- Y - represents a year (in 4 digits).
(click image to view)
############################################################
The Output:
2010/04/05
2010.04.05
2010-04-05
############################################################
Adding a Timestamp
The mktime() function return the Unix timestamp for a date. The Unix timestamp contains the number of seconds between the Unix epoch (January 1 1970 00:00:00 GMT) and the time specified.
Here is the syntax for mktime():
Lets see the example shows below:
(click image to view)
############################################################
The Output:
Yesterday was 04-04-2010
############################################################
No comments:
Post a Comment