ANSI Date and Timestamp function for those who like to type less

The tip I am about to give here is a very interesting Oracle SQL Date and Timestamp function. Also it is a new way to retrieve records filtered by date and timestamp. Oracle supports DATE and TIMESTAMP function that works very well if you want to type less and want to produce same results as normal date function. ANSI DATE and TIMESTAMP were introduced since Oracle 9i into Oracle.

DATE (ANSI)

Without typing a whole lengthy TO_DATE (’01-JAN-2015’, ‘YYYY-MM-DD’) you can retrieve records using below short syntax (up to day precision):

Here 2015-01-01 means ‘2015-01-01 00:00:00’, so if you query with the given date all the records that has date on January 01, 2015 will be fetched irrespective of time.

TIMESTAMP (ANSI)

TIMESTAMP can be used if you want timestamp precision while fetching records. Below syntax can be used for that:

Try this out and tell it to your friends.

For more information on Timestamp you can read this official documentation here.

Did you enjoy this post? Then feel free to put your comments below. Also you can subscribe here to stay updated on latest posts of OracleMine.com.

Hi I am Paras.

Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at hioraclemine@gmail.com. Again I appreciate your visit. Hope to see you again and again!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.