Focal Point
[SOLVED] Date

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

November 27, 2013, 03:07 PM
StevenTCramer
[SOLVED] Date
-SET &CurrentDate = &DATE;
-? &CurrentDate

Yields:

CURRENTLY DEFINED & VARIABLES STARTING WITH 'CurrentDate':
&CurrentDate = 11/27/13

I would like it to be

CURRENTLY DEFINED & VARIABLES STARTING WITH 'CurrentDate':
&CurrentDate = 2013-11-27

The DATEfmt below is invalid.
-SET &CurrentDate = &DATEYY-M-D;

I can do it with a long EDIT and concatenation but I assumed their was some easy way?

This message has been edited. Last edited by: <Kathryn Henning>,


7.7.03, Windows
HTML, Excel, PDF,
November 27, 2013, 03:13 PM
Tom Flynn
Try this


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
November 27, 2013, 03:27 PM
StevenTCramer
-SET &CurrentDate = DATETRAN(&YYMD, '(YYMD)', '(-)','EN', 50, 'A50');
-? &YYMD
-? &CurrentDate

Yeilds:

CURRENTLY DEFINED & VARIABLES STARTING WITH 'YYMD':
&YYMD = 20131127
CURRENTLY DEFINED & VARIABLES STARTING WITH 'CurrentDate':
&CurrentDate = i018-02-25

I obviously do not understand this sorry.


7.7.03, Windows
HTML, Excel, PDF,
November 27, 2013, 03:43 PM
susannah
There is that book "1001 Ways to work with Dates", but alas i don't have one.
i think DATETRAN might be one of those functions that is tough to make work on &vars, not sure.
so, as you say, alot of use of EDIT,
or... cheat.
gets the job done, not quite as elegantly as you might like..
DEFINE FILE ibisamp/CAR
RUN_DATE/YYMD WITH COUNTRY =&YYMD.EVAL ;
DATE2/A10=DATETRAN(RUN_DATE, '(YYMD)', '(-)', 'EN', 10, DATE2)
END
TABLE FILE ibisamp/CAR
PRINT DATE2
IF RECORDLIMIT IS 1
ON TABLE SAVE
END
-RUN
-READ SAVE &newdate.A10
-TYPE &newdate




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 27, 2013, 05:04 PM
jimster06
Tres simple!
-* File test2.fex
-SET &CURRENTDATE1 = &YYMD;
-? &CURRENTDATE1
-SET &CURRENTDATE2 = EDIT('&CURRENTDATE1.EVAL','9999-99-99');
-? &CURRENTDATE2
-EXIT
Happy Thanksgiving


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
November 28, 2013, 12:13 PM
njsden
Plus simple! but it's all the same really Big Grin

-SET &CurrentDate=EDIT(&YYMD,'9999-99-99');
-TYPE &CurrentDate




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
December 02, 2013, 09:29 AM
StevenTCramer
Thanks all. I did give up on the DATETRAN and just went back to the EDIT.

-SET &CurrentDashedDate = EDIT(&YYMD, '9999-99-99');

Thanks for the help.


7.7.03, Windows
HTML, Excel, PDF,
December 02, 2013, 09:32 AM
Tom Flynn
Steven,
Would have worked fine if you add quotes around the 1st &YYMD; the EDIT is easier:

-SET &CurrentDate = DATETRAN('&YYMD', '(YYMD)', '(-)','EN', 50, 'A50');
-? &YYMD
-? &CurrentDate[/quote]


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe