Focal Point
[SOLVED]How to change the date format from tDMYY to dd-mon-yyyy

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

March 16, 2015, 07:26 AM
info4pal
[SOLVED]How to change the date format from tDMYY to dd-mon-yyyy
Hi,

Iam selecting the date values from the calendar control option in the html composer layout ( say for eg:15 Jan, 2015 (tDMYY)) and I need to pass the date in the format of 15-jan-2015....

I tried the formats conversion but nothing is working.

Can anyone tell me how to do this.

Thanks,
IP

This message has been edited. Last edited by: info4pal,


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
March 16, 2015, 09:41 AM
MattC
Here is a very simple example


 
-SET &YY = EDIT(&BegDate1,'$$$$$$$$99');
-SET &MM = EDIT(&BegDate1,'99');
-SET &DD = EDIT(&BegDate1,'$$$99');
-SET &BegMMM = DECODE &MM ('01' 'JAN'
-                            '02' 'FEB'
-                            '03' 'MAR'
-                            '04' 'APR'
-                            '05' 'MAY'
-                            '06' 'JUN'
-                            '07' 'JUL'
-                            '08' 'AUG'
-                            '09' 'SEP'
-                            '10' 'OCT'
-                            '11' 'NOV'
-                            '12' 'DEC');
-SET &BegDate3 = &DD || '-' || &BegMMM || '-' || &YY;

 



WebFOCUS 8.1.05
March 16, 2015, 09:58 AM
MartinY
Hi don't think that there is a direct function to accomplish this, but using Matt example, here is one that creates the format you're requesting:
-SET &DD     = EDIT(&PARMDATE,'99');
-SET &Mth    = EDIT(&PARMDATE,'$$$999');
-SET &CCYY   = EDIT(&PARMDATE,'$$$$$$$$9999');
-SET &NewMth = DECODE &Mth ('Jan' 'jan'
-                           'Feb' 'feb'
-                           'Mar' 'mar'
-                           'Apr' 'apr'
-                           'May' 'may'
-                           'Jun' 'jun'
-                           'Jul' 'jul'
-                           'Aug' 'aug'
-                           'Sep' 'sep'
-                           'Oct' 'oct'
-                           'Nov' 'nov'
-                           'Dec' 'dec');
-SET &NEWDATEFMT = &DD || '-' || &NewMth || '-' || &CCYY;
-TYPE &NEWDATEFMT



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
March 16, 2015, 03:39 PM
jfr99
Maybe something like this ...

-SET &CUR_DMYY = &DMYY;
-*-SET &CUR_DMYY = 01092015;
-SET &CUR_D34 = LOCASE(11, DATETRAN(DATECVT(&CUR_DMYY, 'I8DMYY', 'DMYY'), '(DMYY)', '(t-)', 'EN', 11, 'A11'), 'A11') ;
-TYPE CUR_DMYY ---- &CUR_DMYY
-TYPE CUR_D34 ----- &CUR_D34


WebFocus 8.201M, Windows, App Studio
March 17, 2015, 07:03 AM
info4pal
Hi,

Thanks a lot everyone for the solution.
I will check and let you all know whether it worked or not.

Thanks,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
March 17, 2015, 09:41 AM
DavSmith
FPRINT will also do the trick:

-SET &FPDATE = LOCASE(11, EDIT(FPRINT(&DMYY,'I8DMTYY','A15'),'99-$999-$9999'),'A11');   
-TYPE  &DMYY &FPDATE




In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
March 18, 2015, 09:01 AM
info4pal
Hi,

Thanks a lot everyone!
It worked.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML