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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] converting date to M/DD/YY

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] converting date to M/DD/YY
 Login/Join
 
Member
posted
Trying to convert a date field of MM/DD/YYYY to M/DD/YY

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8105
Windows, Excel
 
Posts: 15 | Registered: November 03, 2017Report This Post
Virtuoso
posted Hide Post
PO

Not sure why you would want to chop off the first digit of month since 10, 11, and 12 would not be correct. You can use the following syntax to do that though.


-SET &DTMDDYY=EDIT(&DATEMDYY,'$99999$$99');


Why don't you just use &DATEMDY?

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
Opps I accidentally overlaid BabakNYC's reply. Babak can you re post yours...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2128 | Location: Customer Support | Registered: April 12, 2005Report This Post
Virtuoso
posted Hide Post
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Member
posted Hide Post
SET &DTMDDYY=EDIT(&DATEMDYY,'$99999$$99');


Why don't you just use &DATEMDY?

I used these in define and they are not working. Did you try the code out previously. Essentially the customer want to suppress the leading zero in the month. 05/05/17 to 5/5/17. Does that help?


WebFOCUS 8105
Windows, Excel
 
Posts: 15 | Registered: November 03, 2017Report This Post
Virtuoso
posted Hide Post
Is this for display purposes only or will you try to use this variable in your code? If it's for the former (and this is a show stopper) you can use an IF THEN ELSE statement to first find out if your month and day segments are less than 10 and mask out the 0. If it's for the latter, you will not be able to use the manipulated zero suppressed variable for WHERE tests.

You should find out how important this is though, because you're going to create a lot of extra code to satisfy a pretty minor requirement. Someone down the road will need to decipher this code to figure out why you're doing all this stuff. The labor involved in one variable might not be much but once you make it the standard, every report with a date variable will have to look this way and you're now stuck with a lot of extra coding.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Guru
posted Hide Post
Or if it's in the data just change the format:
 
TABLE FILE EMPLOYEE
PRINT 
HIRE_DATE
HIRE_DATE/MDY AS 'NEW_HIRE_DATE'
WHERE RECORDLIMIT EQ 2
END
 


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Virtuoso
posted Hide Post
Frans, that won't make 05/05/17 into 5/5/17 though.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Guru
posted Hide Post
OK, thereis probably an easier solution, but it works:

TABLE FILE EMPLOYEE
PRINT 
     EMPLOYEE.EMPINFO.HIRE_DATE/MDY
	 COMPUTE ALPHA_HIRE/A17 = EDIT(HIRE_DATE);
	 COMPUTE TST/A8=TRIM('L',REVERSE(8,EDIT(REVERSE(6,CHGDAT('YMD', 'MDY', EDIT(HIRE_DATE), 'A6'),'A6'),'99/99/99'),'A8'),8,'0',1,'A8');
	 WHERE RECORDLIMIT EQ 1
END
  


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Virtuoso
posted Hide Post
So, if I'm given a spec that says all dates should be treated like this, I'd have to inflate the labor by at least 25% because I know that's not the only place a date will be present in a report or chart. I would also feel obligated to inform the client that this could become an expensive indulgence of a really minor matter of taste and try to talk them out of implementing that specification.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
quote:
So, if I'm given a spec that says all dates should be treated like this, I'd have to inflate the labor by at least 25% because I know that's not the only place a date will be present in a report or chart. I would also feel obligated to inform the client that this could become an expensive indulgence of a really minor matter of taste and try to talk them out of implementing that specification.


Totally agree with Babak.
That request doesn't worth the effort and the maintenance that it will need in the future...

Furthermore, manipulating the date as specified may result that all date function won't work anymore without putting back the leading zeros.
Can you image all the work that this change will cause ?...


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report 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     [CLOSED] converting date to M/DD/YY

Copyright © 1996-2020 Information Builders