Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to round timestamp?

Status
Not open for further replies.

CapsuleCorpJX

IS-IT--Management
Jun 23, 2004
70
US
SELECT average(Query_E_Timestamp - Query_B_Timestamp SECOND(4)) as "Average
FROM dbtest.dbtesttable

Apparently the average returned by the query is very precise, with up to 6 digits right of the decimal.

Anyway, what is a function that can round it to X.Y seconds?

Is there a special way to use CAST(<data> as Format '<format string'>)?
 
Off hand I would say to cast it as Decimal(x+y, y). You could also try removing the (4) from the calculation which indicates 4 decimals.
 
You just specify it: SECOND(4,2)

But remember that the maximum of 9999 seconds is less than 3 hours, so maybe you have to use "hour to second"...

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top