November 10, 2004, 02:31 PM
<Vijaya>Dates Calculation
Can somebody please help me with some dates calc.
I am using the following to calculate the 1st date of this month and the current date.
-SET &START_DATE = EDIT(&DATEYYMD,'99999999') || '01';
-SET &END_DATE = &DATEYYMD;
I need to calculate the 1st date of last month and the last date of last month.
These have to be variables as I use them with conditional 'if' statements.
thanks
vijaya
November 10, 2004, 02:57 PM
jimster06FOCUS and WebFOCUS have a number of powerful date functions. They can be examined in the Technical Documentation Library that is accessible from the upper right of this screen.
Check EOM and BOM.
HTH
November 10, 2004, 03:34 PM
<Pietro De Santis>End of month, use the DATEMOV function:
-SET &EOMDATE =
- DATECVT((DATEMOV((DATECVT(&SYSTEM_DATE,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
The DATECVT function is required in Dialog Manager to convert the text date into a date format.
End of last month, use the AYM command to subtract one from the current month, then use the DATEMOV function:
-SET &WS_YYMM = EDIT(&SYSTEM_DATE,'999999');
-SET &WS_YYMM1 = AYM(&WS_YYMM, -1, 'I6');
-SET &WS_YYMMDD1 = &WS_YYMM1 || '01';
-SET &EFFDATE =
- DATECVT((DATEMOV((DATECVT(&WS_YYMMDD1,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');
-END_ME_DATE
I hope this helps.
November 12, 2004, 06:23 PM
<Vijaya>Thank you. I had tweak it a little. But this worked. Thanks once again.
March 13, 2007, 02:14 PM
JohnBThis is a variation of the intial request.
I find working with functions fairly easy when using them with fields, but tend to have difficulties when using them with amper variables.
How would you change &START_DATE's value from I8YYMD to MtrDYY?
For example 20070122 should be traslated to January 22, 2007.
Thanks,
John
March 13, 2007, 02:24 PM
Alan BAlmost, very easily:
-SET &START = 20070122;
-SET &NEWSTART = CHGDAT('YYMD','MDYYX',&START,'A17');
Gives JANUARY 22 2007
| In Focus since 1993. WebFOCUS 7.7.03 Win 2003 |
March 13, 2007, 02:31 PM
FrankDutchAlan
Did you use the function to do this in your mother language?
Frank
|
Frank |
| prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7 |
March 13, 2007, 02:41 PM
Alan BYes Frank, just coming to that.
-SET &START=20070122;
-SET &YY = EDIT(&START,'9999');
-SET &M = EDIT(&START,'$$$$99');
-SET &D = EDIT(&START,'$$$$$$99');
-SET &NEWM = DATETRAN (&M, '(M)', '(tr)', 'EN', 40, 'A40');
-SET &NEWDATE = &NEWM || (' '| &D | ', ' | &YY);
-TYPE &NEWDATE
Gives January 22, 2007.
Change EN to PT gives Janeiro 22, 2007.
Alan.
WF 7.705/8.007
March 13, 2007, 02:55 PM
Danny-SRLJohn and Vijaya,
Try this:
-SET &NOW='20070122';
-SET &SHOW=DATETRAN(DATECVT(&NOW, 'I8YYMD', 'DMYY'), '(MDYY)', '(trD)', 'EN', 40, 'A40') ;
-TYPE &NOW &SHOW
Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
March 13, 2007, 03:00 PM
Alan BOh Nice. Forgot about DATECVT.
Alan.
WF 7.705/8.007
March 13, 2007, 03:04 PM
mgrackinThere is a book by John Price which discusses EVERYTHING about dates which you may want to buy a copy of.
"(almost) 1001 Ways to Work with DATES in WebFOCUS"
Thanks!
Mickey
| FOCUS/WebFOCUS 1990 - 2011 |
March 13, 2007, 05:08 PM
JohnBDanny,
EXCELLENT!
Mickey,
What's the ISBN # of the book?
hanks,
John
WF 7.7.03, Windows 7, HTML, Excel, PDF
March 14, 2007, 09:09 AM
<DocServices>Hi John,
Information Builders is now the worldwide, exclusive publisher of John W. Price's Keysheet Guides, previously published by Aviter Inc. The
(Almost) 1001 Ways to Work With Dates for WebFOCUS book can be purchased through our Technical Documentation Library website:
http://documentation.informationbuilders.com/masterindex/keysheet_manuals.aspHope this helps.
Regards,
Jenn
March 14, 2007, 09:48 AM
FrankDutchquote:
Daniel
wf 7.1/WinXP/IIS/SSA
www.srl.co.il
I admired your website....
looks impressive.
|
Frank |
| prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7 |