Focal Point
[CLOSED] DateTime field format manipulation needed *ddh*

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

September 12, 2011, 03:37 PM
Denny99
[CLOSED] DateTime field format manipulation needed *ddh*
How do I convert (i.e. functions to use) the following Datetime field formats
2011/09/07 11:48:22.000
TO
09/07/2011 11:48:22 AM.
It seems to reason there has to be a easy way to do this?? Any assistance is GREATLY APPRECIATED. I'm using WebFocus version 7.1.4 currently.

This message has been edited. Last edited by: Kerry,
September 12, 2011, 05:14 PM
Tomsweb
quote:
How do I convert (i.e. functions to use) the following Datetime field formats
2011/09/07 11:48:22.000



quote:

TABLE FILE CAR
PRINT CAR MODEL

COMPUTE RAISETIME/HMDYYIA = DT(2011/09/07 11:48:22.000);
COMPUTE MYTEST/HHIA = RAISETIME;
END
-RUN



Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
September 12, 2011, 05:14 PM
Prarie
DEFINE FILE CAR
NEWDATE/HMDYYSA = DT(2011/09/07 11:48:22.0000;
END
TABLE FILE CAR
PRINT CAR NEWDATE
END
September 12, 2011, 05:16 PM
Prarie
Well Tom - we hit that at the same time...
September 12, 2011, 05:20 PM
Tomsweb
LOL, you have a syntax error.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
September 12, 2011, 05:49 PM
Waz
Denny99, as you can see, it is a simple case of setting a DEFINE or COMPUTE field to the format needed, then applying the datetime field.

This is because the format of the field indicated that its format is datetime, and what format to show it in.

You should have a look at the documentation on datetime fields, and the edit options for it.

Describe a Date-Time Field


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 12, 2011, 11:32 PM
Denny99
Thanks for all your replies but unfortunately none of these worked. First, our version of Webfocus is 7.1.4 and it didn't recognize the function HMDYYIA or HHIA. I can get the date portion to the format I want but when I try putting it all together with the time (minus the micro seconds 000) it doesn't work. It's important to get the AM or PM depending on the time of the day. The master file defines this field as partcular field as HYYMDs. Unfortunately, our environment is so locked down I'm unable to change this format. Thanks again for all those that replied.
September 12, 2011, 11:47 PM
Waz
What did you try ?

All you should have to do is a DEFINE or COMPUTE
e.g.
DEFINE FILE ???
NEW_FIELD/HMDYYS = OLDFIELD ;
END


or

TABLE FILE ???
.
.
COMPUTE NEW_FIELD/HMDYYS = OLDFIELD ;
.
.
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 13, 2011, 08:33 AM
Denny99
Thanks for the recent reply WAZ. I tried just redefining the field and my results are close but I still can't get the "AM" or "PM" at the end of the date. Instead it's giving me 24hour time. I could write code to evaluate the time and manually adjust but I wouldn't think that would be necessary. Again, thanks so much for responding to my scream for help. Have a great day.
September 13, 2011, 09:02 AM
jfr99
Hi,

Here's an example using CAR.

-*
DEFINE FILE CAR
CNT/I3 WITH COUNTRY = CNT + 1;
A_DTS/A14 = DECODE CNT (
1 '20110907114822'
2 '20110907120505'
ELSE '???');
END
-*
TABLE FILE CAR
PRINT
CNT
A_DTS
WHERE RECORDLIMIT EQ 2
ON TABLE HOLD
END
-*
DEFINE FILE HOLD
SD_DTS/HYYMDS = HINPUT(14, A_DTS, 8, 'HYYMDS');
-*
SD_DTS1/HYYMDs = SD_DTS;
SD_DTS2/HMDYYSA = SD_DTS;
END
-*
TABLE FILE HOLD
PRINT
CNT
A_DT
SD_DTS
SD_DTS1
SD_DTS2
END

Does this help?

Jim


WebFocus 8.201M, Windows, App Studio