Friday, March 31, 2006

From the Edge: Understanding New DATE Functions
Section: Functions
Chapter: Running R:BASE Your Way!
Platform: R:BASE 7.5 and V-8 Turbo for Windows
Builds: R:BASE 7.5 (7.5.25.30331 or higher)
        R:BASE V-8 Turbo (8.0.12.30331 or higher)

The following six DATE functions have been added to
the latest versions of R:BASE 7.5 and V-8 Turbo for
Windows, Build: 7.5.25.30331 and 8.0.12.30331.

. (IDOY(date)) - Integer Day of the Year
. (IWOY(date)) - Integer Week of the Year
. (IDIM(date)) - Integer Days in a Month
. (ILY(date))  - Is Leap Year (1,0)
. (DNW(date))  - Next Working (Business) Date
. (DWE(date))  - Next Weekend Date

Example 01:

-- Integer Day of the Year (IDOY):
SET VARIABLE vIntDayOfYear INTEGER = NULL
SET VARIABLE vIntDayOfYear = (IDOY(.#DATE))
-- The variable vIntDayOfYear will return the integer
-- day of the year.

Example 02:

-- Integer Week of the Year (IWOY):
SET VARIABLE vIntWeekOfYear INTEGER = NULL
SET VARIABLE vIntWeekOfYear = (IWOY(.#DATE))
-- The variable vIntWeekOfYear will return the integer
-- week of the year.

Example 03:

-- Integer Days in a Month (IDIM):
SET VARIABLE vIntDaysInMonth INTEGER = NULL
SET VARIABLE vIntDaysInMonth = (IDIM(.#DATE))
-- The variable vIntDaysInMonth return the integer
-- days in a month.

Example 04:

-- Is Leap Year (ILY): (1 = Yes, 0 = No)
SET VARIABLE vIsLeapYear INTEGER = NULL
SET VARIABLE vIsLeapYear = (ILY(.#DATE))
-- The variable vIsLeapYear will return 1 if the
-- year is a leap year, and 0 if it is not.

Example 05:

-- Next Working (Business) Date (DNW):
SET VARIABLE vNextBusinessDate DATE = NULL
SET VARIABLE vNextBusinessDate = (DNW(.#DATE))
-- The variable vNextBusinessDate will return date
-- of next business date.

Example 06:

-- Next Weekend Date (DWE):
SET VARIABLE vNextWeekEndDate DATE = NULL
SET VARIABLE vNextWeekEndDate = (DWE(.#DATE))
--The variable vNextWeekEndDate will return date
-- of next weekend date.

Preview:
http://www.razzak.com/sampleapplications/files/NDateFun.jpg

A PDF version of this article is available at:

From The Edge: http://www.razzak.com/fte

A sample application to demonstrate the use of new
DATE functions is also available at:

Sample Applications:
http://www.razzak.com/sampleapplications

Enjoy and make sure to have fun!

Very Best R:egards,

Razzak.

Reply via email to