I am using the following code to get the month component and it is returning a value of 11 for the current date 2016/06/21
DTPART(&MDYY, MONTH)
The output looks like
LoadMonth LoadDate 11 06/21/2016
Where LoadDate = &MDYY
Any ideas what I am doing wrong?This message has been edited. Last edited by: Trudy,
WF8 Windows
June 21, 2016, 02:53 PM
Trudy
&DATEM gave me the value of 6 which is at least correct. I am wondering why the DTPART and DPART functions were not returning the correct values?
WF8 Windows
June 21, 2016, 03:18 PM
MartinY
I think that the reason is because &MDYY is not a date/date time format such as explained in the F1-Help of DTPART:
Syntax: How to Return a Date or Date-Time Component in Integer Format
DTPART(date, component)
where:
date
Date or date-time
Is the date in standard date or date-time format.
component
Keyword
Is the component to extract in integer format. Valid components (and values) are:
YEAR (1-9999).
QUARTER (1-4).
MONTH (1-12).
WEEK (of the year, 1-53). This is affected by the WEEKFIRST setting.
DAY (of the Month, 1-31).
DAY_OF_YEAR (1-366).
WEEKDAY (day of the week, 1-7). This is affected by the WEEKFIRST setting.
HOUR (0-23).
MINUTE (0-59).
SECOND (0-59.)
MILLISECOND (0-999).
MICROSECOND (0-999999).
Here a sample:
DEFINE FILE EMPDATA
MTH/I2 = DTPART(HIREDATE, MONTH);
END
TABLE FILE EMPDATA
PRINT HIREDATE MTH
BY PIN
ON TABLE SET PAGE NOPAGE
END
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
June 21, 2016, 03:36 PM
Francis Mariani
In Dialogue Manager, &YYMD works, if it's in quotes: