Previous Document Next Document
CorelScriptTools.GetDateInfo

Sub GetDateInfo(Date As Date, Year As Long, Month As Long, Day As Long, DayOfWeek As Long)

Member of CorelScriptTools

The GetDateInfo method extracts the components of a date expression to numeric variables.

Parameter
Description
DateExp
Specifies the date expression to extract components from
Year
Specifies the numeric variable that is assigned the year component from the specified date expression
Month
Specifies the numeric variable that is assigned the month component from the specified date expression
Day
Specifies the numeric variable that is assigned the day component from the specified date expression
DayOfWeek
Specifies the numeric variable that is assigned the day of week component from the specified date expression. Sunday corresponds to 1, Monday to 2, and so on.

  • The GetDateInfo method can accept only a date value between January 1, 1980 (date serial number 29221) and December 31, 2099 (date serial number 73050). If a date outside this range is specified, an error occurs.

In the following code example, the first line declares the date variable TodayDate. This variable is then assigned the current date with the GetCurrDate function. The variables Y, M, D, and DW are then assigned their respective component of the date stored in TodayDate. If TodayDate was set to May 29, 1996, then Y=1996, M=5, D=29, and DW=4.

DIM TodayDate AS DATE 
TodayDate = GETCURRDATE() 
GETDATEINFO TodayDate, Y&, M&, D&, DW& 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.