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

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] converting date to M/DD/YY
Go
New
Search
Notify
Tools
Reply
  
[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, 2017Reply With QuoteReport 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 8204, Unix, Windows
 
Posts: 1608 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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: 1488 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
 
Posts: 1608 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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, 2017Reply With QuoteReport 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 8204, Unix, Windows
 
Posts: 1608 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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: 381 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Frans, that won't make 05/05/17 into 5/5/17 though.


WebFOCUS 8204, Unix, Windows
 
Posts: 1608 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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: 381 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport 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 8204, Unix, Windows
 
Posts: 1608 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2074 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

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

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