Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] DMYY to calendar week

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DMYY to calendar week
 Login/Join
 
Member
posted
My fellow WebFocus-Users,

I am seraching for a way to convert a DMYY field in order to recieve info in which calendar week (plus year) the date fell. So what i need is a field with the format CW'/'YY.
Anyone any idea? Realy apreciate it.
Further info: if helpful my DMYY-field is also available as an integer-field.

Thanks and best regards,

Florian

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 22, 2012Report This Post
Guru
posted Hide Post
You may wish to consider the function HYYWD; it returns the year and week number from a date-time value.
It is up to you to make sure that the argument you pass to it is a date-time value.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Platinum Member
posted Hide Post
You might have to 'tweak' this to get exactly what you want, but I would find the number of days siince 1/1, divide by 7 and concatenate that value onto the year portion of field.

 
DEFINE FILE CAR
   FIRSTDAY/DMYY WITH COUNTRY = 01012012;
   FIRST_DAY/YYMD = FIRSTDAY;
   YOUR_FIELD/DMYY WITH COUNTRY = &DMYY ;
	LAST_DATE/YYMD = YOUR_FIELD;
   DAYS/I5 = DATEDIF(FIRST_DAY, LAST_DATE, 'D');
   WEEKS/I2 = DAYS/7;
   WEEK_ALPHA/A2 = EDIT(WEEKS);
   DATE_TXT/A8 = DATECVT(LAST_DATE, 'YYMD', 'A8YYMD') ;
   FINAL_ANSWER/A8 = WEEK_ALPHA || '/' || EDIT(DATE_TXT, '9999');
END
 


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
 
Posts: 132 | Location: Gadsden, Al | Registered: July 22, 2005Report This Post
Expert
posted Hide Post
Not sure if this gives you the correct week number but...

TABLE FILE TRADES
PRINT DATE_OF_TRADE
COMPUTE YEAR/YY = DATE_OF_TRADE ;
COMPUTE WEEK/W = DATE_OF_TRADE ;
COMPUTE CWYY/A7 = EDIT(WEEK) | '/' | EDIT(YEAR) ;
WHERE RECORDLIMIT EQ 100
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Waz:
Not sure if this gives you the correct week number but...

TABLE FILE TRADES
PRINT DATE_OF_TRADE
COMPUTE YEAR/YY = DATE_OF_TRADE ;
COMPUTE WEEK/W = DATE_OF_TRADE ;
COMPUTE CWYY/A7 = EDIT(WEEK) | '/' | EDIT(YEAR) ;
WHERE RECORDLIMIT EQ 100
END


You'll want to set the WEEKFIRST parameter to either Sunday (1) or Monday (2), depending on what standard your week numbering needs to follow. The default appears to be 6 (Saturday), which makes me wonder in which country the week starts at Saturday?!?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
quote:
rfbowley

Thank u rfbowley. Genius.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 22, 2012Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by rfbowley:
You might have to 'tweak' this to get exactly what you want, but I would find the number of days siince 1/1, divide by 7 and concatenate that value onto the year portion of field.

 
DEFINE FILE CAR
   FIRSTDAY/DMYY WITH COUNTRY = 01012012;
   FIRST_DAY/YYMD = FIRSTDAY;
   YOUR_FIELD/DMYY WITH COUNTRY = &DMYY ;
	LAST_DATE/YYMD = YOUR_FIELD;
   DAYS/I5 = DATEDIF(FIRST_DAY, LAST_DATE, 'D');
   WEEKS/I2 = DAYS/7;
   WEEK_ALPHA/A2 = EDIT(WEEKS);
   DATE_TXT/A8 = DATECVT(LAST_DATE, 'YYMD', 'A8YYMD') ;
   FINAL_ANSWER/A8 = WEEK_ALPHA || '/' || EDIT(DATE_TXT, '9999');
END
 


Ah, if it were that simple! In countries that follow the ISO-8601 standard for week numbering, the first of Januari can fall in week 1 or 52 or 53, depending on whether that date is before or after Wednesday and how many weeks the previous year had.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
So what would you suggest?
I'm really bad at this.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 22, 2012Report This Post
Expert
posted Hide Post
Valid values are ISO1-ISO7
  
SET WEEKFIRST = ISO2 
TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME 
  COMPUTE NEWSAL/D12.2M = CURR_SAL + (0.5 * CURR_SAL);
  COMPUTE DATE1/HYYMDIA = DT(20050101 09:00AM);
  COMPUTE DATE2/DMYY    = HDATE(DATE1, 'DMYY');
  COMPUTE ISODATE/A10   = HYYWD(DATE1, 'A10');
END



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Well Tom, it appears that YOU can teach an old dog a new trick :-)

Thanks, I learned something new.


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
 
Posts: 132 | Location: Gadsden, Al | Registered: July 22, 2005Report This Post
Expert
posted Hide Post
Hi Robert,

Welcome, BUT, I'm probably the 'old dog'! Cool


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
Just want to make sure you installed the 64 bit version of WF and not the 32 bit version. I made that mistake on Windows and it did not work. Installed the 64 bit version of WF and everything worked just fine.


Prod: Webfocus 7.6.4
Test: Webfocus 7.6.10
Windows
Excel, PDF, HTML
 
Posts: 1 | Registered: January 28, 2010Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] DMYY to calendar week

Copyright © 1996-2020 Information Builders