DATE FUNCTIONS IN VBSCRIPT


DATE FUNCTIONS:
  1. CDate (date)-converts a valid date and time expression to type Date, and returns the result
         Syntax: CDate (date)
         Example: CDate(#4/22/10#)
         Output: 4/22/2010

  1. Date-Returns the current system date
Syntax: Date ()
Example: response.write(Date)
Output: 12/3/2014

  1. Day(date)- returns a number between 1 and 31 that represents the day of the month.
Syntax: Day(Date)
Example: response.write(Day("2010-02-16"))
Output: 16

  1. Hour(time)- returns a number between 0 and 23 that represents the hour of the day.
Syntax: Hour(time)
Example: response.write(Hour("13:45"))
Output: 13
  1. Minute(time)- returns a number between 0 and 59 that represents the minute of the hour.
Syntax: Minute(time)
Example: response.write(Minute("13:45"))
Output: 45

6.Month(date)- returns a number between 1 and 12 that represents the month of the year.
Syntax: Month(date)
Example: response.write(Month("2010-02-16"))
Output: 2
7.MonthName(x)- returns the name of the specified month.
Syntax: MonthName(x)
Example: response.write(MonthName(8))
Output: August
8. Now()-returns the current date and time according to the setting of your computer's system date and time.
Syntax: Now
Example: response.write(Now)
Output: 12/4/2014 1:41:16 AM
9. Second(time)- returns a number between 0 and 59 that represents the second of the minute.
Syntax: Second(time)
Example: response.write(Second("13:45:21"))
Output: 21
10.time()-returns the current system time.
Syntax: time()
Example: response.write(Time)
Output: 1:40:00 AM
11.      Weekday(date[,firstdayofweek])-returns a number between 1 and 7, that represents the day of the week.
Syntax: Weekday(date[,firstdayofweek])
Example: response.write(Weekday("2010-02-16",0))
Output: 3
12.Weekdayname()-returns the weekday name of a specified day of the week.
Syntax: Weekdayname((weekday[,abbreviate[,firstdayofweek]]))
Example: response.write(WeekdayName(3))
Output: Tuesday
13.Year(date)-  returns a number that represents the year.
Syntax: year(date)
Example: response.write(Year("2010-02-16"))
Output: 2010



No comments:

Post a Comment