IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Diff between date fields in minutes
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Help!! I need to develop a report that takes 2 date fields (SQLSRVR Date-Time stamp) and computes the difference between them in minutes. I can't seem to find a date function that utilizes the time portion of the date-time stamp. This will be utilized to determine how many hours someone works on a given day derived from timeclock data.

Any help would be greatly appreciated!!
Thanks!
Chuck
 
Posts: 12 | Registered: May 05, 2004Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
I believe the function you are looking for is

HDIFF

HDIFF: Finding the Number of Units Between Two Date-Time Values

HDIFF(value1, value2, 'component', outfield) where:

value1: Is the end date-time value, the name of a date-time field that contains the value, or an expression that returns the value.

value2: Is the start date-time value, the name of a date-time field that contains the value, or an expression that returns the value.

component: Is the name of the component to be used in the calculation enclosed in single quotation marks. If the component is a week, the WEEKFIRST parameter setting is used in the calculation.

outfield: Alphanumeric, Is the field that contains the result, or the format of the output value enclosed in single quotation marks. The format must be floating-point double-precision.

In WebFOCUS, you must specify the format. In Maintain, you must specify the name of the field.
 
Posts: 610 | Location: Dallas, Texas | Registered: May 24, 2004Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks for the post TS!

That's the function I was looking at too, but couldn't find any documentation on the "component" piece of the syntax. I've seen examples of 'Day', 'Month', 'Year' used to compute the differences in those respective time slices....but no example of a difference between dates in say....'minutes'? Would the component be 'minute' or perhaps 'seconds'?

Thanks!
Chuck
 
Posts: 12 | Registered: May 05, 2004Reply With QuoteEdit or Delete MessageReport This Post
<Pietro De Santis>
Posted
HDIFF(value1, value2, 'component', outfield)

Component
---------
year
quarter
month
day-of-year
day
are
week
weekday
hour
minute
second
millisecond
microsecond

I find the Date Functions documentation in the Using Functions manual not very easy to use. Look for "Reference: Arguments for Use With Date and Time Functions".
 
Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks Pietro!! Works like a charm!

Your soooo right about the date documentation!
 
Posts: 12 | Registered: May 05, 2004Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Diff between date fields in minutes

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.