Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Time portion of datetime

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Time portion of datetime
 Login/Join
 
Member
posted
There must be a simple solution to this, but I've tried everything I can find in the IBI docs and nothing is working.
I have a datetime field 'LogDate' in an SQL Server table where a typical value looks like:
10/18/2005 3:02:55 PM

I need to separate the date and time into two fields displayed in different columns, as well as reformat the date. The following command works fine:
DisplayDate/MtDYY = LogDate;
results in the desired Oct 18, 2005 being displayed.

I cannot however get the time by itself. I tried
DisplayTime/HhISA = LogDate;
plus I tried everything else that looked promising, such as DATECVT, HCNVRT, HNAME, EDIT; everything resulted in an error.
What to do?
 
Posts: 18 | Location: Rockville, MD | Registered: September 20, 2005Report This Post
Silver Member
posted Hide Post
You may be looking for HTIME ...?

HTIME (length, dtfield, 'Dformat')

length
Is the length of the input date-time value. Valid values are:

8 for time values down to milliseconds.

10 for input time values down to microseconds.

dtfield
Is the date-time value to use for extracting the time. You can supply the name of a date-time field, a date-time constant, or an expression that returns a date-time value.

Dformat
Is the USAGE format of the returned number of milliseconds or microseconds, enclosed in single quotation marks.


now convert the output to time format....

DEFINE FILE CAR
DT1 /A20 = IF COUNTRY EQ 'ENGLAND' THEN '20000626054500000' ELSE '20000205033000000';
TRANSDATE /HYYMDS = HINPUT(14, DT1, 8, 'HYYMDS');
THETIME /D14.2 = HTIME(8, TRANSDATE, 'D14.2');
MYHRS /I2 = INT(THETIME / 60 / 60 / 1000);
MYMINS /I2 = INT(THETIME - (MYHRS * 60 * 60 * 1000)) / 60 / 1000;
MYSECS /I2 = INT(THETIME - (MYHRS * 60 * 60 * 1000) - (MYMINS * 60 * 1000) ) / 1000;
MYTIME /A9 = EDIT(MYHRS) | EDIT(MYMINS) | EDIT(MYSECS) | '000';
OUTTME /A8 = EDIT(MYTIME,'99:99:99');
END

TABLE FILE CAR
PRINT TRANSDATE
THETIME
OUTTME
BY COUNTRY NOPRINT
IF COUNTRY EQ 'ENGLAND' OR 'FRANCE'
END

Hope this helps,
Paul.
 
Posts: 42 | Location: UK | Registered: October 23, 2005Report This Post
Platinum Member
posted Hide Post
Here's another option to add to Paul's example:

DEFINE FILE CAR
DT1/A20 = IF COUNTRY EQ 'ENGLAND' THEN '20000626054500000' ELSE '20000205033000000';
TRANSDATE/HYYMDS = HINPUT(14, DT1, 8, 'HYYMDS');
-* (THIS GIVES YOU ALPHA DATE/TIME)
TMP_DTS/A20 = HCNVRT(TRANSDATE,'(HYYMDS)',20,'A20');
-* (THIS GIVES YOU SMART DATE)
TMP_DATE/YYMD = HDATE(TRANSDATE,'YYMD');
-* (THIS GIVES YOU ALPHA TIME)
TMP_TIME/A8 = EDIT ((HCNVRT(TRANSDATE,'(HYYMDS)',20,'A20')),'$$$$$$$$$$$99999999$');
END
TABLE FILE CAR
PRINT
TRANSDATE
TMP_DTS
TMP_DATE
TMP_TIME
BY COUNTRY NOPRINT
IF COUNTRY EQ 'ENGLAND' OR 'FRANCE'
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Gold member
posted Hide Post
If you happen to be on an older version of FOCUS, you can change the master file to reflect the entire date time stamp as an A19(or is it A17...I can't count right now), anyway, if you change it to Alpha, you could easily then split it into two separate parts. Just keep in mind that once you go down the Alpha route, it can be a bear to bring it back to representing time.

Just two cents worth from an older coder who used to have to do it prior to the really cool time functions we have now.
 
Posts: 90 | Registered: April 15, 2004Report This Post
Expert
posted Hide Post
Stan,

If I remember correctly, the equivalent alpha for an actual of DATE was A26. I can certainly remember having to use that format against DB2 in the early years!! Red Face



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Time portion of datetime

Copyright © 1996-2020 Information Builders