Php Getting Started Tutorial (21) php date and time functions
- Echo time (); /// return "1264668961"
- ?>
2, date () The date () function is required to convert the UNIX timestamp to the readable current time. The prototype of the date function is as follows:
- Echo date ("Y/m/d ");
- Echo"
";
- Echo date ("Y. m. d ");
- Echo"
";
- Echo date ("Y-m-d ");
- ?>
Output: 2013/11/212013.11.212013-11-21 3. the mktime () function returns the Unix timestamp of a date. Parameter description:
- Echo (date ("M-d-Y", mktime )));
- Echo (date ("M-d-Y", mktime )));
- Echo (date ("M-d-Y", mktime )));
- Echo (date ("M-d-Y", mktime )));
- ?>
Output: The Jan-05-2002Feb-01-2002Jan-01-2001Jan-01-1999 4, checkdate () function verifies a greaguri date. If the specified value is valid, the function returns true; otherwise, false. The date is valid in the following cases: the value of month between and including 1-12 days is within the range of days that a given month should have, and the leap year has been taken into account. Year is between and includes the syntax checkdate (month, day, year) parameter from 1 to 32767
- Var_dump (checkdate (12, 31, 2000 ));
- Var_dump (checkdate (2003 ));
- Var_dump (checkdate (2004 ));
- ?>
Output: bool (true) bool (false) bool (true) >>> View more php tutorials < |