Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: TIMESTAMP: EXTRACT Jump to:  
Category: >> Oracle PL/SQL >> TIMESTAMP: EXTRACT Bookmark and Share

<< lastnext >>

Snippet Name: TIMESTAMP: EXTRACT

Description: Returns the value of a specified datetime field from a datetime or interval value expression.

Also see:
» FUNCTIONS: date/time
» TIMESTAMP: TZ_OFFSET
» TIMESTAMP: TRUNC
» TIMESTAMP: SysTimeStamp
» TIMESTAMP: SYS_EXTRACT_UTC
» TIMESTAMP: SessionTimeZone
» TIMESTAMP: LocalTimestamp
» TIMESTAMP: FROM_TZ
» TIMESTAMP: DUMP
» TIMESTAMP: DBTIMEZONE
» TIMESTAMP: Get current timestamp
» TIMESTAMP: List time zones

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 04th, 2009

EXTRACT (
{ YEAR | MONTH | DAY | HOUR | MINUTE | SECOND }
| { TIMEZONE_HOUR | TIMEZONE_MINUTE }
| { TIMEZONE_REGION | TIMEZONE_ABBR }
FROM { date_value | interval_value } )
 
VALUES that can be extracted:
 
YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
TIMEZONE_HOUR
TIMEZONE_MINUTE
TIMEZONE_REGION
TIMEZONE_ABBR
 
-- You can only extract YEAR, MONTH, and DAY from a DATE.
-- You can only extract TIMEZONE_HOUR and TIMEZONE_MINUTE 
-- from a timestamp with a time zone datatype.
 
EXTRACT (<type> FROM <datetime | interval>)
SELECT EXTRACT(YEAR FROM DATE '2007-04-01') FROM dual;
 
xtract(YEAR FROM DATE '2003-08-22')      -- would return 2003
EXTRACT(MONTH FROM DATE '2003-08-22')   -- would return 8
EXTRACT(DAY FROM DATE '2003-08-22')      -- would return 22
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 129 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?