Focal Point
[SOLVED] Date Time T Separator

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

May 16, 2016, 02:03 PM
Mikey
[SOLVED] Date Time T Separator
I need my date time fields to have a T between date and time yyyy-mm-ddThh:mm:ss.

Example: 2016-04-01T13:45:23

I found a T separator option in the Help file:
- T applies the letter “T” as the separator.
Note: The T separator option is available for DateTime field formats (which is the U separator in the Master File), and enables recognition and output of the ISO standard format, where T is the delimiter between date and time.

I don't understand how to get it to work. Anyone use this before?

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


8007
Windows 7, PDF, Excel
May 16, 2016, 02:10 PM
GavinL
Mikey, if you come to my desk, I'll let you borrow my "1001 Ways to Work with DATES in WebFOCUS" book..



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 16, 2016, 02:12 PM
GavinL
Here are some high level tips..

-TYPE .
-TYPE Using EDIT()
-* Date formatting
-SET &FROM_DATE = '30/12/2015';
-SET &DATE1 = EDIT(&FROM_DATE,'$$$99') | '/' | EDIT(&FROM_DATE,'99') | '/' | EDIT(&FROM_DATE,'$$$$$$9999');
-TYPE FROM_DATE = >&FROM_DATE<
-TYPE DATE1 = >&DATE1<

-TYPE .
-TYPE Using EDIT()
-SET &FROM_DATE = '20160501';
-SET &DATE1 = EDIT(&FROM_DATE,'$$$$99') | '/' | EDIT(&FROM_DATE,'$$$$$$99') | '/' | EDIT(&FROM_DATE,'9999');
-TYPE FROM_DATE = >&FROM_DATE<
-TYPE DATE1 = >&DATE1<

-TYPE .
-TYPE Using EDIT()
-SET &FROM_DATE = '2016-01-17T00:00:00';
-SET &DATE1 = EDIT(&FROM_DATE,'9999') | '/' | EDIT(&FROM_DATE,'$$$$$99') | '/' | EDIT(&FROM_DATE,'$$$$$$$$99');
-TYPE FROM_DATE = >&FROM_DATE<
-TYPE DATE1 = >&DATE1<

-TYPE .
-TYPE Using HGETC(), HDIFF(), FPRINT()
-SET &DT1 = HGETC(8, 'HYYMD-s');
-SET &SLP = SLEEP(1.3, 'I4');
-SET &DT2 = HGETC(8, 'HYYMD-s');
-SET &DTDIFF = HDIFF(&DT2, &DT1, 'MILLISECOND', 'I8');
-SET &DT1 = FPRINT(&DT1, 'HYYMD-s', 'A23');
-SET &DT2 = FPRINT(&DT2, 'HYYMD-s', 'A23');

-TYPE DT1 = >&DT1<
-TYPE DT2 = >&DT2<
-TYPE DTDIFF = >&DTDIFF<
-RUN

-TYPE .
-TYPE Using DATEADD() -30
-SET &DT1 = &YYMD;
-SET &DT2 = (DATECVT((DATEADD((DATECVT(&DT1,'I8YYMD','YYMD')),D,-30)),'YYMD','I8YYMD'));
-TYPE DT1 = >&DT1<
-TYPE DT2 = >&DT2<




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 16, 2016, 02:36 PM
David Briars
Try putting a 'U' between the date and time format components, and setting DTSTANDARD:
SET DTSTANDARD = ON
SET PAGE = OFF
DEFINE FILE CAR
-* Create a field in DATE-TIME Format.
 MIKEY/HYYMDS = DT(2005 DEC 26 05:45);
-* Convert format.  
 LIFECEREAL/HYYMDUS  = MIKEY;
END
TABLE FILE CAR
PRINT CAR NOPRINT 
      MIKEY 
      LIFECEREAL
IF RECORDLIMIT EQ 1
ON TABLE SET STYLEMODE FIXED
END  

MIKEY                LIFECEREAL                                               
-----                ----------                                               
2005-12-26 05:45:00  2005-12-26T05:45:00  

May 16, 2016, 02:50 PM
Mikey
This is what I was missing
SET DTSTANDARD = ON
Thank you!


8007
Windows 7, PDF, Excel
May 16, 2016, 02:57 PM
GavinL
quote:
SET DTSTANDARD = ON
SET PAGE = OFF
DEFINE FILE CAR
-* Create a field in DATE-TIME Format.
MIKEY/HYYMDS = DT(2005 DEC 26 05:45);
-* Convert format.
LIFECEREAL/HYYMDUS = MIKEY;
END
TABLE FILE CAR
PRINT CAR NOPRINT
MIKEY
LIFECEREAL
IF RECORDLIMIT EQ 1
ON TABLE SET STYLEMODE FIXED
END






- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 16, 2016, 03:03 PM
Mikey
This is not working when I use EXL07 output


8007
Windows 7, PDF, Excel
May 16, 2016, 04:03 PM
David Briars
We don't do a lot of MS Excel output; when we do we use FORMAT EXL2K.

When I added 'ON TABLE PCHOLD FORMAT EXL2K' to the model code the data appeared fine in Excel 2013.

This message has been edited. Last edited by: David Briars,




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
May 17, 2016, 02:03 PM
Mikey
I forgot about the EXL07 output getting different results with certain code. I bumped the HYYMDUS code up to a HOLD table and the T is there in my output table.

COMPUTE EVNT_ACT_DTTM/A20 = HCNVRT(EVENT_ACTUAL_DTTM, '(HYYMDUS)', 20, 'A20');

Mikey Likes It!


8007
Windows 7, PDF, Excel