VBScript DateValue function
DateValue function to convert a string to a Date.
Note: If the year portion of the date is omitted, then the function uses the current year from the computer system date.
Note: If thedate parameter contains time information, the time information will not be returned. If an invalid date time information contained in, the run-time error occurs.
grammar
DateValue(date)
参数 | 描述 |
---|---|
date | 必需。一个介于 100 年 1 月 1 日到 9999 年 12 月 31 日的日期,或者任何可表示日期、时间或日期时间兼有的表达式。 |
Examples
Examples
<script type="text/vbscript">
document.write(DateValue("31-Jan-10"))
document.write("<br />")
document.write(DateValue("31-Jan"))
</script>
document.write(DateValue("31-Jan-10"))
document.write("<br />")
document.write(DateValue("31-Jan"))
</script>
Examples of the above output:
1/31/2010
1/31/2010
1/31/2010
try it"
Complete VBScript Reference