Time and Date Functions

Time and Date functions allow you to customize your web pages in many different ways.  Here are some of the most commonly used time and date functions:

DateValue

strResult = DateValue("January 15, 2000")

The DateValue function converts an expression into a date subtype.  In this example, it returns the value ” 1/15/2000 “.

 

Day

strResult = Day("1/15/2000")

The Day function extracts the day value from a date expression.  In this example, it returns the value ” 15″.

 

Weekday

strResult = Weekday("1/15/2000")

The Weekday function extracts the day value from a date expression.  In this example, it returns the value ” 7 “.

 

Month

strResult = Month("1/15/2000")

The Month function extracts the day value from a date expression.  In this example, it returns the value ” 1 “.

 

Year

strResult = Year("1/15/2000")

The Year function extracts the day value from a date expression.  In this example, it returns the value ” 2000 “.

 

Now

strResult = Now

The Now function returns the current date and time according to the current setting of the computer or server.  In this example, it returns the value ” 5/7/2015 2:52:37 PM “.

 

Time

strResult = Time

The Time function returns the current time according to the current settings.  In this example, it returns the value ” 2:52:37 PM “.

 

Hour

strResult = Hour(Now)

The Hour function returns the current time according to the current settings.  In this example, it returns the value ” 14 “.

 

Minute

strResult = Minute(Now)

The Minute function returns the current time according to the current settings.  In this example, it returns the value ” 52 “.

 

Second

strResult = Second(Now)

The Second function returns the current time according to the current settings.  In this example, it returns the value ” 37 “.

< Back to ASP Scripts