date - How to round current time in teradata and insert into timestamp(6) fields -
i have table date fields of timestamp(6)
fields .
create table test_time ( t1 timestamp(6) format 'mm/dd/yyyy hh:mm:si' , );
i want insert table current date , time rounded.
i.e. example if current date time 08/07/2014 10:34:56
value in table should 08/07/2014 10:00:00
.
(or) if current data , time 08/07/2014 10:54:56
value should be
08/07/2014 10:34:56
your first example truncating time, not rounding.
truncating can done this:
current_timestamp(0) - extract(minute current_timestamp(0)) * interval '1' minute - extract(second current_timestamp(0)) * interval '1' second
but don't second example, there's no truncation/rounding @ all, it's subtracting 20 minutes?
Comments
Post a Comment