To format a time and/or date
----------------------------------------------------------------------------------------------------------------------------------
PHP Date() - Format the Date
Here are some characters that can be used:
- d - Represents the day of the month (01 to 31)
- m - Represents a month (01 to 12)
- Y - Represents a year (in 4 digits)
############################################################
The Output:
2010/03/21
2010.03.21
2010-03-21
############################################################
PHP Date() - Adding a Timestamp
The optional timestamp parameter in the date() function specifies a timestamp. If you do not specify a timestamp, the current date and time will be used.
The mktime() function returns 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.
Syntax for mktime():
mktime(hour,minute,second,month,day,year,is_dst)
For instances:
############################################################
The Output: Tomorrow is 2010/03/21
############################################################
.jpg)


0 comments:
Post a Comment