Focal Point
How to extract both month and day

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3801061271

June 15, 2006, 01:21 PM
LEX-IA
How to extract both month and day
Hi Guys,

I have a date field. Let's name it order_date.
The format is YYMD. I would like to know how to extract both the month and the day from order_date...

I have read the documentation but didnt find a solution in extracting only both month and day.

Any suggestions?


PROD: WebFOCUS 7.1.0 on Linux/Tomcat 5.5.12 (standalone)/Informix on AIX
TEST: WebFOCUS 7.1.3 on Linux/Tomcat 5.5.16 (standalone)/Informix on AIX
June 15, 2006, 01:32 PM
Mikel
For example:

TABLE FILE CAR
  PRINT
    COMPUTE ORDER_DATE/YYMD = &YYMD ;
    COMPUTE MONTH/M = ORDER_DATE ;
    COMPUTE DAY/D = ORDER_DATE ;
    COUNTRY NOPRINT
END

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
June 15, 2006, 04:11 PM
LEX-IA
Ok, I see so there isnt one function to it in one shot.
so all i need now is to concatenate them!
works for me

Thank you


PROD: WebFOCUS 7.1.0 on Linux/Tomcat 5.5.12 (standalone)/Informix on AIX
TEST: WebFOCUS 7.1.3 on Linux/Tomcat 5.5.16 (standalone)/Informix on AIX
June 15, 2006, 04:21 PM
Mikel
Working with dates, there are multiples ways, and there are many date functions, but in this case, aren't specially necessary.

If you want month and day concatenated... Another example:

TABLE FILE CAR
  PRINT
    COMPUTE ORDER_DATE/YYMD = &YYMD ;
    COMPUTE ODA8/A8YYMD = ORDER_DATE ;
    COMPUTE ODMD/A4 = EDIT(ODA8, '$$$$9999') ;
    COUNTRY NOPRINT
END

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
June 15, 2006, 05:16 PM
Prarie
and if you need a '/'

COMPUTE ODM/A2 = EDIT(ODA8, '$$$$99$$') ;
COMPUTE ODD/A2 = EDIT(ODA8, '$$$$$$99') ;
COMPUTE MD/A5 = ODM |'/'| ODD;


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Come on Prarie, don't forget -

COMPUTE ODA8/A8YYMD = ORDER_DATE ;
    COMPUTE ODMD/A5 = EDIT(ODA8, '$$$$99/99') ;
Winky

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
I have recently come across this problem of extracting the day and month separetely from the date field. We have a function available to do this. It works fine.

HNAME(DATE, 'MONTH', MON)

HNAME is the function
DATE is the original field which contains the
date
MONTH is the field you want to extract
MON is the temporary field which I have created to stroe the extracted month value

To do this Go to Define option, click on new button...Give the name for your temporary field...Select the function button..Under category select date & time..HNAME is the function....& so on...

Please let me know if it does not work..


Regards,
Ashok Kumar M
Yes Tony...that's better..brain was not working..that late in the day. Eeker


In Focus since 1993. WebFOCUS 7.7.03 Win 2003