Year Function

Tips >>ASP Functions

WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE


The Year function returns a number that represents the year. The Year function returns the number of the current year using any valid date expression as an argument. It returns a whole number representing the year.


It explains One Mandatory Argument :-

  • Date :- Any expression that can represent a date. If date contains Null, Null is returned.

Note :- You can also use the Now functions as the argument.

The Syntax of Year function is :-

Year(date)

Example#1 :-

Code :-
document.write(Date & "<br />")
document.write(Year(Date))
Output :-
1/15/2002
2002

Example#2 :-

Code :-
<%
=Year(23-May-2006)
%>
Output :-
2006

Example#3 :-

Code :-
<%
=Year("6/26/43")
%>
Output :-
1943

Example#4 :-
It explains Date Argument

Code :-
MyYear = Year("1-Apr-2006")
Output :-

2006

Example#5 :-

Code :-
Dim MyDate, MyYear
MyDate = #October 19, 1962# '
MyYear = Year(MyDate) '
Output :-
MyYear contains 1962.


 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641