Date Functions

The following Visual Basic commands have been tested with IDEA v9 and appear to be functioning properly. I have added some examples where possible on their use.


Returns the system date (no time information).


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


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.

FormatDateTime(Date, NamedFormat)

Date is the date expression to be formatted. NamedFormat is an optional constant that specifies how the date is formatted.


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


Minute(date) Returns a value 0–59 representing the minute of the hour


Month(date) Returns a value 1–12 representing the month of the year


Returns the system date and time as a type Date.