Focal Point
[SOLVED]How to change the date format from HYYMDS to MDYY along with the time

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

December 31, 2014, 04:58 AM
info4pal
[SOLVED]How to change the date format from HYYMDS to MDYY along with the time
Hi,

Iam using the below format for date:
COMPUTE ALPHA_DATE/A20 = HCNVRT(DATEPARAM, '(H17)', 17, 'A20');
COMPUTE MYDATE/HYYMDS = HINPUT(20, ALPHA_DATE, 10,'HYYMDS');

The output would be 2014/04/28 5:52:39PM
but I need it in this format : 4/28/2014 5:52:39 PM

Could anyone please let me know how can this be done.

Thanks a lot in advance!

Regards!

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


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
December 31, 2014, 06:36 AM
Ram Prasad E
Try below compute instead.
COMPUTE ALPHA_DATE/A20 = HCNVRT(DATEPARAM, '(H17)', 17, 'A20');
COMPUTE MYDATE/HMDYYSB = HINPUT(20, ALPHA_DATE, 10,'HMDYYSB');



WebFOCUS 8.1.05
Windows
http://ibiwebfocus.wordpress.com
https://www.facebook.com/groups/ibi.webfocus/
January 02, 2015, 01:09 AM
info4pal
Hi Ram,

Thanks a lot for the solution!
It helped!

Regards!


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
January 02, 2015, 04:30 AM
Alan B
This conversion does not need to be done in 2 phases.
COMPUTE ALPHA_DATE/A23 = HCNVRT(input_date,'(HMDYYSB)',23,'A23');
or
COMPUTE INT_DATE/HMDYYSB = input_date;



Alan.
WF 7.705/8.007
January 02, 2015, 09:08 AM
jgelona
If DATEPARM is your date time field and the format is HYYMDS, to print it with a format of HMDYYSB, just do this:

TABLE FILE XXXXX
PRINT DATEPARM/HMDYYSB
END


With the FOCUS language, you have USAGE/display and ACTUAL/internal formats. The USAGE format can be changed on the fly by doing what I did above. If you have a 60 character field and all you want to display is the first 20 characters, just use FIELD/A20. There is no need to do a SUBSTR or EDIT first.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
January 07, 2015, 01:47 AM
info4pal
Hi,

Thanks a lot Alan and Jgelona for the responses and for the solution!
This worked too!!

Regards!


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML