VBScript DateSerialFunction
Complete VBScript Reference
The DateSerial function returns a Variant of subtype Date for the specified year, month, and day.
Syntax
DateSerial(year,month,day)
| Parameters | Description |
|---|---|
| year | Required. A number from 100 to 9999, or a numeric expression. Values between 0 and 99 are interpreted as 1900–1999. For all other year arguments, use a complete 4-digit year. |
| month | Required. Any numeric expression. |
| day | Required. Any numeric expression. |
Examples
Example 1
<script type="text/vbscript">
document.write(DateSerial(2010,2,3))
</script>
document.write(DateSerial(2010,2,3))
</script>
The output of the above example is:
2/3/2010
Try it Yourself »
Example 2
Subtract 10 days:
<script type="text/vbscript">
document.write(DateSerial(2010,2,3-10))
</script>
document.write(DateSerial(2010,2,3-10))
</script>
The output of the above example is:
1/24/2010
Try it Yourself »
Complete VBScript Reference Other Extensions