Home > Backend Development > PHP Tutorial > checkdate Verify a Gregorian date_PHP tutorial

checkdate Verify a Gregorian date_PHP tutorial

WBOY
Release: 2016-07-15 13:22:04
Original
953 people have browsed it

checkdate

(PHP 4, PHP 5)

checkdate — 验证一个格里高里日期

说明

bool checkdate ( int $month , int $day , int $year )

如果给出的日期有效则返回 TRUE,否则返回 FALSE。检查由参数构成的日期的合法性。日期在以下情况下被认为有效:

  • year 的值是从 1 到 32767
  • month 的值是从 1 到 12
  • Day 的值在给定的 month 所应该具有的天数范围之内,闰年已经考虑进去了。

 

 

Example #1 checkdate() 例子

<!--?php
var_dump(checkdate(12, 31, 2000));
var_dump(checkdate(2, 29, 2001));
?-->
Copy after login

以上例程会输出:

bool(true) bool(false)

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/447018.htmlTechArticlecheckdate (PHP 4, PHP 5) checkdate验证一个格里高里日期 说明 boolcheckdate(int$month,int$day,int$year) 如果给出的日期有效则返回TRUE,否则返回FALSE。检查...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template