ASP History Functions

ASP History Functions

Now ()

Returns the current system date and time of the server.

Sample:

Code: <% = Now ()%>

Screen Output: 02.11.2003: 22:59:20

 

Date ()

Returns the current system date of the server.

Sample:

Code: <% = date ()%>

Screen Output: 02.11.2003

 

Time ()

Returns the current system time of the server.

Sample:

Code: <% = time ()%>

Screen Output: 22:36:17

 

Day (date)

When used with a date parameter, it gives the day of the date.

Sample:

Code: <% = Day (date)%>

Screen Output: 2 (2nd day of the month)

 

Weekday (date)

When used in conjunction with a date parameter, it gives us the date of the date. (Sunday = 1, Monday = 2 C .Cuma = 6, Saturday = 7)

Sample:

Code: <% = Weekday (date)%>

Screen Output: 1

 

Month (date)

When used with a date parameter, it gives the month of the date.

Sample:

Code: <% = Month (date)%>

Screen Output: 11 (month 11)

 

Year (date)

When used with a date parameter, it returns the year of the date.

Sample:

Code: <% = year (date)%>

Screen Output: 2003

 

Hour (date)

When used with a date parameter, it gives the current time.

Sample:

Code: <% = Hour (Now)%>

Screen Output: 23

 

Minute (date)

When used with a date parameter, it gives the current minute.

Sample:

Code: <% = Minute (Now)%>

Screen Output: 36

 

Second (date)

When used with a date parameter, it gives the current seconds.

Sample:

Code: <% = Second (Now)%>

Screen Output: 42

 

CDATA (string)

Converts the date format string to date

IsDate (string)

Tests whether a string is a date. Returns True or False.

Sample:

Code: <% = IsDate ( "11/02/2003")%>

Screen Output: True

Code: <% = Isdate ((Rehberim Online =)%>

Display Output: False

 

Dateadd (type, number, date)

Add a value to a date or time, depending on a specific parameter. The following is the parameter table:

parameter Description

yyyy Year

m Month

d Day

w Day of the week (Tuesday, Wednesday, etc.)

h Hour

n Minutes

s second

 

 

Sample:

Code: Dateadd (“m,, 3,“ 2.11.2003 Date)

Screen Output: 2.02.2004

Code: Dateadd (“d,, 3,“ 2.11.2003 Date)

Screen Output: 5.11.2003

Code: Dateadd (“h,, 3,“ 20:30:11 Date)

Screen Output: 23:30:11

 

DateDiff (type, 1st, 2nd, date)

The time difference between the two dates is again based on certain parameters. The parameter table is the same as above.

Sample:

Code: DateDiff (20: d .01, Now, ”02.01.2004 20:20:29 Date)

Screen Output: 61 (Now = 02.11.2003 23:26:13)