VBScript DateValueFunction


VBScript 参考手册Complete VBScript Reference Manual

The DateValue function converts a string to a Date.

Note:If the year part of the date is omitted, the function uses the current year from the computer system's date.

Note:If the date parameter contains time information, the time information will not be returned. If the date contains invalid time information, a run-time error will occur.

Syntax

DateValue(date)

Parameter Description
date Required. A date between January 1, 100 and December 31, 9999, or any expression that can represent a date, a time, or both date and time.

Example

Example

<script type="text/vbscript">

document.write(DateValue("31-Jan-10"))
document.write("<br />")
document.write(DateValue("31-Jan"))

</script>

The output of the above example is:

1/31/2010
1/31/2010

Try it Yourself »


VBScript 参考手册Complete VBScript Reference Manual Other Extensions