Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
Dates Calculation
 Login/Join
 
<Vijaya>
posted
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
 
Reply With QuoteReport This Post
Guru
posted Hide Post
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
 
Posts: 252 | Location: USA | Registered: April 15, 2003Reply With QuoteReport This Post
<Pietro De Santis>
posted
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.
 
Reply With QuoteReport This Post
<Vijaya>
posted
Thank you. I had tweak it a little. But this worked. Thanks once again.
 
Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Almost, very easily:

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

Gives JANUARY 22 2007


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Nice.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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

 
Posts: 1936 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Oh Nice. Forgot about DATECVT.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Danny,

EXCELLENT!



Mickey,

What's the ISBN # of the book?


hanks,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Reply With QuoteReport This Post
<DocServices>
posted
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
 
Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.