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


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.



Syntax: DateSerial(Year as integer, Month as integer, Day as integer)

The DateSerial function creates a Date value from separate month, day, and year values.


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


Returns the system date and time as a type Date.


Returns the system date (no time information).


Returns the current system time (no date information).


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


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


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.


Hour(date) Returns a value 0–23 representing the hour of the day


Subscribe to RSS - Date