Focal Point
Help with Dates

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1251022382

May 07, 2008, 04:26 AM
Ved
Help with Dates
I have a Date value stored in a String. The value is in 'DD/MM/YYYY' format.

I need to convert it into a Date format (Default WebFOCUS Date Format HYYMDS) (A17).

Can you please provide me the steps to do it. Please note that I do not want this in the DEFINE.

I have a variable and I want to hold the new value in another variable.


Web Focus 7.1.6
Hosted on Unix Box
May 07, 2008, 06:40 AM
Danny-SRL
Ved,

I suppose that in your second variable you want an alpha date in date-time format. Here is what you can do:
  
-SET &D1='07/05/2008';
-SET &DH=HCNVRT(HDTTM(DMY(31121900, EDIT(&D1,'99$99$9999')), 8, 'HYYMDS'), '(HYYMDS)', 20, 'A20');
-SET &DH17=HCNVRT(HDTTM(DMY(31121900, EDIT(&D1,'99$99$9999')), 8, 'HYYMDS'), '(H17)', 17, 'A17');
-TYPE &D1
-TYPE &DH
-TYPE &DH17

Or any other format you wish to have.

Explanations:
EDIT(&D1,'99$99$9999') gets rid of the slashes
DMY(31121900, EDIT(&D1,'99$99$9999')) claculates the number of days from the origin of focus dates, converting the alpha date to a DMYY format
HDTTM(DMY(31121900, EDIT(&D1,'99$99$9999')), 8, 'HYYMDS') converts the focus date to a date-time
HCNVRT converts the date-time to alpha according to the specified format in parentheses.

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF