Focal Point
[SOLVED]Remove timestamp from a datetime field

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

September 02, 2016, 10:25 AM
SSurana
[SOLVED]Remove timestamp from a datetime field
Hi,

What is the best way to remove the timestamp from a datetime field in WebFocus?
e.g. From ‘2015/08/31 00:00:00.000’, keep only 2015/08/31 and remove the timestamp: 00:00:00.000.

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
September 02, 2016, 10:32 AM
BabakNYC
If you have an HYYMDS, get rid of the S.

Say you have a field called ORDERDATE which is defined as HYYMDS in the metadata. You can reformat it by doing this:

TABLE FILE ORDERS
SUM FREIGHT
BY ORDERDATE
BY ORDERDATE/HYYMD
END

You'll get something that looks like this:
ORDERDATE	                ORDERDATE       FREIGHT
1996/07/04 12:00:00.000000AM	1996/07/04	32.3800



WebFOCUS 8206, Unix, Windows
September 02, 2016, 11:02 AM
SSurana
Thanks a lot, Guru! That worked.
I see the date in format YYYY/MM/DD. Is there a way I can change this to MM/DD/YYYY?


WebFOCUS 8
Windows, All Outputs
September 02, 2016, 11:06 AM
BabakNYC
Yes. You can extract or move around any part of the HYYMD fields like this:

TABLE FILE ORDERS
SUM FREIGHT
BY ORDERDATE
BY ORDERDATE/HMDYY
END



WebFOCUS 8206, Unix, Windows
September 02, 2016, 11:23 AM
SSurana
Thanks for all your help, Guru! I really appreciate it!


WebFOCUS 8
Windows, All Outputs