Year

Return a four-digit year (a number from 1900 to 9999) for a given date value.

Syntax
      Year(date_value)

Key
   date_value  A valid date.

Examples

Dim intDemo
intDemo = Year(dtmShiftEnd)
intDemo = Year(#31/12/2012#)

Select * from orders where Year(Order_date) = 2012;

In VBScript return the current date in ISO8601 format:

Function isoDate()
' This script uses the functions Day, Month, and Year because
' they do not rely on the user’s regional settings.

   dtmNow = Date()

   dtmDay = Day(dtmNow)
   dtmMonth = Month(dtmNow)
   dtmYear = Year(dtmNow)

   isoDate = dtmYear & "-" & dtmMonth & "-" & dtmDay
End Function

“I’m spending a year dead for tax reasons” ~ Douglas Adams

Related VBScript commands

Day - Return the day of the month.
DatePart - Return part of a given date.
Month - Return the month for a given date.
GetDate.vbs - Return the current Year/month/Day and time.


 
Copyright © 1999-2024 SS64.com
Some rights reserved