473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DB2: Round timestamp to 29 mins

Hi - Can I round timestamp to next 29 mins ?

For instance -

If current date is : 2014-06-20 10:29:00.000000, can i round it to 2014-06-20 10:00:00.000000 ?

Thanks,
Sid
Jun 20 '14 #1
2 3386
Luuk
1,047 Expert 1GB
TRUNC_TIMESTAMP scalar function

Read syntax diagramSkip visual syntax diagram
.-,--'DD'---------------------------.
>>-TRUNC_TIMESTAMP--(--expression--+-----------------------------------+--)-><
'-,--format-string--+-------------+-'
'-locale-name-'

The schema is SYSIBM.

The TRUNC_TIMESTAMP scalar function returns a TIMESTAMP that is the expression truncated to the unit specified by the format-string. If format-string is not specified, expression is truncated to the nearest day, as if 'DD' was specified for format-string.

Expand|Select|Wrap|Line Numbers
  1. SELECT TRUNC_TIMESTAMP(current time,"HH")  ....
  2.  
Jun 21 '14 #2
Anas Mosaad
185 128KB
Expand|Select|Wrap|Line Numbers
  1. db2 "select trunc_timestamp(current timestamp + cast((30  + extract(second from current timestamp))/ 60 as int) minutes, 'minute'), current timestamp from sysibm.sysdummy1"
Jun 23 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: db2sysc | last post by:
All, We have listed out the INBUILT Function differences between Sybase and DB2. Kindly provide your feedback or corrections and for CHANGES - DO WE NEED TO CODE our own UDFs?
7
by: Ross | last post by:
Hi, I want to change this query SELECT current timestamp FROM sysibm.sysdummy1; so it returns 2005-11-09-00.00.0.000000 not 2005-11-09-15.31.33.132000. Basically stip the time of the timestamp...
16
by: Brian Tkatch | last post by:
I have a PROCEDURE that test other PROCEDUREs. Timings_Call ------------------ Id Group Name Text Timings_Log
138
by: Ian Boyd | last post by:
i've been thrown into a pit with DB2 and have to start writing things such as tables, indexes, stored procedures, triggers, etc. The online reference is only so helpful. The two pdf manuals are...
2
by: V_S_H_Satish | last post by:
Dear Friends I am working as oracle and ms sql dba from last 4 years. My company recently migrated to DB2 databases. So i am very much new to db2 database Can any one pls provide script to...
5
by: Dmitry Bond. | last post by:
Hello. Our product works fine on all 7.x and 8.x DB2 versions. But stops to work on DB2 v9.1. The main problem is - duplicate primary key (sqlcode=-803) happens when inserting records in...
6
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue , and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
0
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue today and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
0
by: Sumanth | last post by:
Hi, We are running into some issues when doing LOAD. 1) client issues a cliload at T1 2) db2diag.log indicates that the load,build phase completes in 2 minutes. This happens at T1 + 30 mins...
1
by: stefan.albert | last post by:
Hi folks, when subtracting 2 timestamps from each other the result is duration. () But in DB2 the format is a bit funny: lets say we have 59,5 seconds. If we have one second more, the result is:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.