April 04, 2013, 01:01 AM
Shankar [CLOSED] Date format in maintain
Hi All,
I have date values in DMYY format. I want to display it into Month,year format. i.e Suppose the date value is 20/03/2013 I want to display it as 'March,2013'. I want to do it maintain. Is there any function available for this? Please suggest.
Thanks in advance.
This message has been edited. Last edited by: <Kathryn Henning>, April 12, 2013 09:59 AM April 04, 2013, 05:12 AM
Alan B Convert the date into MYY format and then use DATETRAN.
declare mdate/MYY;
.
.
.
Case convert
repeat dateStack.foccount i/i4=1;
mdate = dateStack(i).DATE;
displayDate = DATETRAN(mdate,'(MYY)','(trc)','EN',15,displayDate);
endrepeat i=i+1;
EndCase
You can also take the displayDate value and place it straight back into an MYY field if required.
April 04, 2013, 07:54 AM
Maintain Wizard You could avoid using the subroutine and just have:
MAINTAIN
COMPUTE TODAY/MDYY='03042013';
COMPUTE THEN1/MtrYY = TODAY;
TYPE "<
END This will do it as well. Mark April 04, 2013, 08:37 AM
Shankar Hi Alan,
If there is NULL value for date it is displaying value 'December, 1900'. How to avoid it? Please suggest.
Thanks.
April 04, 2013, 10:08 AM
Alan B
displayDate = if dateStack(i).DATE is missing then ' ' else DATETRAN(mdate,'(MYY)','(trc)','EN',15,displayDate);
If you bring the field back in, then you will have to set the date to missing if displayDate is blank.
@Mark
The format MtrYY will display 'APR 2013' not 'April, 2013'. Suspect it should display 'April, 2013', but it doesn't.