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
  
Reformatting a date.
 Login/Join
 
Silver Member
posted
Hi,

I am trying to do something rather simple and
am having problems with it.

I want to reformat a character date value from a YYYYMMDD format to another character type date value that is in a MM/DD/YYYY format.

Thank you in advance.

Tom


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
 
Posts: 31 | Registered: June 01, 2009Reply With QuoteReport This Post
Silver Member
posted Hide Post
With assistance from a co-worker, I have my answer. Hopefully the below will help someone having a
similar challenge.

-> to convert the alpha date from YYYYMMDD to MMDDYYYY... targetDateField/A8=CHGDAT('YYMD', 'MDYY', sourceDateField, 'A8');

-> to introduce the date separators... formattedDate/A10=EDIT(targetDateField, '99/99/9999');


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
 
Posts: 31 | Registered: June 01, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
Being an alpha field you could have also use EDIT.
targetDateField/A8=EDIT(sourcedateField,'99/99/') | EDIT(sourcedateField,'$$$$9999'); 



Ooops got the format wrong.

As per Madhumitha's post

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6053 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
hi,
you want to convert a character date value from yyyymmdd to chatacter date value of mm/dd/yyyy right, then the following code will help you.

targetfield/A10=EDIT(inputfield, '$$$$99/99/')|EDIT(inputfield, '9999')

it will convert yyyymmdd format to character date of mm/dd/yyyy correctly

Eg: inputfield =20080301
then outputfield=03/01/2008

Regards,
Madhu

This message has been edited. Last edited by: Madhumitha,
 
Posts: 51 | Registered: September 30, 2008Reply With QuoteReport This Post
Gold member
posted Hide Post
TomG,
If you are going to be dealing with dates often I would recommend that you get use to working with the DATECVT(DATE-FIELD,'IN-FORMAT','OUT-FORMAT') function.

Anytime I'm dealing with dates I seem to require moving to and from smartdates or expressing my date in a format other than what has supplied from my data.


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Reply With QuoteReport This Post
Gold member
posted Hide Post
Waz,
What wrong format you got according to my post???
 
Posts: 51 | Registered: September 30, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
Just saying that my original post had the format of the date wrong, where yours was right


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6053 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
AAARGH. I've tried everything I can think of. Nothing works.

I have a field in the database defined as A10. The actual data in the field is 9/30/2011
I want to convert this to 2011-09-30.
How can I do this?


7.7.02
Windows
EXCEL, PDF, CSV, TEXT
 
Posts: 106 | Registered: June 25, 2009Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Never mind. I don't need this afterall.


7.7.02
Windows
EXCEL, PDF, CSV, TEXT
 
Posts: 106 | Registered: June 25, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 


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