Skip to main content

Date

DateDiff()

Syntax: DateDiff(Interval as String, Date1 as Date, Date2 as Date, Optional DayOfWeek, Optional WeekOfYear) as Long

Parameters:

Interval - There are 10 different types of intervals.  Depending on the interval the DateDiff() well return the number of units in the Interval.  Below is a list of the 10 items.  In the script below I used constants to better define them.

Parameter

DateValue()

Syntax: DateValue(StringDate as String) as Date

The DateValue function assignes a specific data to a type Date variable.  Converting a string representation of a date into a Date value.

Parameters: The StringDate can be different date formats in string, the following are a few examples:

  • "January 10 2007"
  • "January 10" - defaults to current system year
  • "Jan 10 2007"
  • "10/Jan/2007"
  • "10/01/2007"
  • "10/Jan/2007 14:10:10" - won't return the time portion

TimeSerial

Use the TimeSerial function to create time values for type Date variables.

For TimeSerial, the values are normally in the range 0 to 23 for hours, and 0 to 59 for minutes and seconds. Larger values wrap to the next larger unit; therefore, a seconds value of 90 corresponds to one minute and 30 seconds

Day()

Syntax: Day(DateValue as Date) as integer

Day(date) Returns a value 1–31 representing the day of the month

Parameter: The DateValue must be a valid date.