Date.asDateTime(year, month, day, hour, minute, second[, millisecond])

作者:vkvi 来源:ITPOW(原创) 日期:2010-7-26

返回 ezj

Date.asDateTime(year, month, day, hour, minute, second[, millisecond]) 判断指定的年月日时分秒或年月日时分秒毫是否是时间日期。

语法

Date.asTime(year, month, day, hour, minute, second[, millisecond])

参数

  • year integer。要判断的年。
  • month integer。要判断的月。
  • day integer。要判断的日。
  • hour integer。要判断的时。
  • minute integer。要判断的分。
  • second integer。要判断的秒。
  • millisecond integer。可选。要判断的毫秒。

返回值

boolean。year、month、day、hour、minute、second、millisecond 是否是正确的日期时间。

示例

alert(Date.asDateTime(2010, 1, 1, 24, 0, 0)); // false,不存在 24 时,最大值为 23:59:59.999
alert(Date.asDateTime(2010, 1, 1, 23, 59, 59, 1000)); // false,毫秒最大值为 999
alert(Date.asDateTime(2010, 2, 29, 13, 14, 15)); // false,2010 年 2 月只有 28 天
alert(Date.asDateTime(2010, 1, 1, 13, 14, 15)); // true
alert(Date.asDateTime(2010, 1, 1, 13, 14, 15, 67)); // true
相关文章