Focal Point
Dates Calculation

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

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
jimster06
FOCUS 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
JohnB
This 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


WF 7.7.03, Windows 7, HTML, Excel, PDF
March 13, 2007, 02:24 PM
Alan B
Almost, very easily:

-SET &START = 20070122;
-SET &NEWSTART = CHGDAT('YYMD','MDYYX',&START,'A17');

Gives JANUARY 22 2007


Alan.
WF 7.705/8.007
March 13, 2007, 02:30 PM
Prarie
Nice.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Alan

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

Yes 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
John 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

Oh Nice. Forgot about DATECVT.


Alan.
WF 7.705/8.007
There 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
Danny,

EXCELLENT!



Mickey,

What's the ISBN # of the book?


hanks,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
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.asp

Hope this helps.

Regards,
Jenn
quote:
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