|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
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 |
||
|
|
Member |
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 |
|||
|
|
Virtuoso |
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...
|
|||||||||||
|
|
Member |
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, |
|||
|
|
Gold member |
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 7.6.11 WFS 7.6.11 I-Way for iSeries |
|||
|
|
Member |
Waz,
What wrong format you got according to my post??? |
|||
|
|
Virtuoso |
Just saying that my original post had the format of the date wrong, where yours was right
Waz...
|
|||||||||||
|
| Powered by Social Strata |
| Please Wait. Your request is being processed... |
|

