Latest web development tutorials

VBScript DateSerial function

VBScript Reference Complete VBScript Reference

DateSerial function returns the year, month, day Date subtype of Variant.

grammar

DateSerial(year,month,day)

参数 描述
year 必需。介于 100 到 9999 的数字,或数值表达式。介于 0 到 99 的值被视为 1900–1999。对于所有其他的 year 参数,请使用完整的 4 位年份。
month 必需的。任何数值表达式。
day 必需的。任何数值表达式。

Examples

Example 1

<script type="text/vbscript">

document.write(DateSerial(2010,2,3))

</script>

Examples of the above output:

2/3/2010

try it"

Example 2

Minus 10 days:

<script type="text/vbscript">

document.write(DateSerial(2010,2,3-10))

</script>

Examples of the above output:

1/24/2010

try it"


VBScript Reference Complete VBScript Reference