Byte My Data

A personal collection of advice and solutions I've used.

About the author

Something about the author

Get the date parts of a date in Oracle

Original Post: http://decipherinfosys.wordpress.com/2007/07/19/extracting-day-month-or-year-from-a-date-field/

Oracle uses an EXTRACT(datetime) function to extract the value of a specified datetime field from a datetime expression. Function is very handy to manipulate specific datetime field value like day, month or year. Following values can be extracted from the column having date datatype. Apart from values mentioned below, timezone related values like timezone_region, timezone_hour and timezone_minute can also be obtained using EXTRACT function if underlying datatype is TIMESTAMP WITH TIME ZONE. * Day, Month, Year, Hour, Minute, Second

SELECT EXTRACT(Year FROM My_Date) as Year

Permalink | Comments (0) | Post RSSRSS comment feed

Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading