2010-03-04 6 views
5

Je dois extraire l'heure 'complète' d'un horodatage. Comme pour 2010.03.04 13:13 je veux 2010.03.04 13:00 (comme un timestamp à nouveau).Oracle Timestamp: extraire l'heure complète

Mon approche actuelle est:

TO_TIMESTAMP(TO_CHAR(m.begin, 'yyyy.mm.dd hh24'), 'yyyy.mm.dd hh24') 

Est-ce vraiment la voie à suivre? Qui est-ce bon/mauvais fait-il (je prévois de faire un GROUP BY dessus).

Merci pour votre participation!

Cheers, Reto

Répondre

7
SELECT TRUNC(m.begin, 'HH24') 
FROM mytable m 
+0

Merci! Parfait .. – reto

+0

Voici les documents officiels: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions230.htm – Vadzim