EXTRACT(unit FROM date): extracts parts from the date rather than performing date arithmetic : EXTRACT « Date Time Functions « MySQL Tutorial
MySQL Tutorial
1.
Introduction
2.
Select Query
3.
Database
4.
Table
5.
Table Join
6.
Subquery
7.
Insert Update Delete
8.
Logic Operator
9.
View
10.
Data Types
11.
Procedure Function
12.
Cursor
13.
Trigger
14.
Date Time Functions
15.
Comparison Functions Operators
16.
Aggregate Functions
17.
Cast Functions Operators
18.
Control Flow Functions
19.
Encryption Compression Functions
20.
Information Functions
21.
Math Numeric Functions
22.
Miscellaneous Functions
23.
String Functions
24.
Regular Expressions
25.
Data Dictionary
26.
MySQL Utilities
27.
Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
MySQL Tutorial
»
Date Time Functions
»
EXTRACT
14. 17. 1. EXTRACT(unit FROM date): extracts parts from the date rather than performing date arithmetic
The following table shows the expected form of the expr argument for each unit value.
unit Value
Expected expr Format
MICROSECOND
MICROSECONDS
SECOND
SECONDS
MINUTE
MINUTES
HOUR
HOURS
DAY
DAYS
WEEK
WEEKS
MONTH
MONTHS
QUARTER
QUARTERS
YEAR
YEARS
SECOND_MICROSECOND
'SECONDS.MICROSECONDS'
MINUTE_MICROSECOND
'MINUTES.MICROSECONDS'
MINUTE_SECOND
'MINUTES:SECONDS'
HOUR_MICROSECOND
'HOURS.MICROSECONDS'
HOUR_SECOND
'HOURS:MINUTES:SECONDS'
HOUR_MINUTE
'HOURS:MINUTES'
DAY_MICROSECOND
'DAYS.MICROSECONDS'
DAY_SECOND
'DAYS HOURS:MINUTES:SECONDS'
DAY_MINUTE
'DAYS HOURS:MINUTES'
DAY_HOUR
'DAYS HOURS'
YEAR_MONTH
'YEARS-MONTHS'
14. 17. EXTRACT
14. 17. 1.
EXTRACT(unit FROM date): extracts parts from the date rather than performing date arithmetic
14. 17. 2.
SELECT EXTRACT(YEAR FROM '1999-07-02');
14. 17. 3.
SELECT EXTRACT(YEAR_MONTH FROM '1999-07-02 01:02:03');
14. 17. 4.
SELECT EXTRACT(DAY_MINUTE FROM '1999-07-02 01:02:03');
14. 17. 5.
SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 6.
SELECT EXTRACT(SECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 7.
SELECT EXTRACT(MINUTE FROM '2003-01-02 10:30:00.000123');
14. 17. 8.
SELECT EXTRACT(HOUR FROM '2003-01-02 10:30:00.000123');
14. 17. 9.
SELECT EXTRACT(DAY FROM '2003-01-02 10:30:00.000123');
14. 17. 10.
SELECT EXTRACT(WEEK FROM '2003-01-02 10:30:00.000123');
14. 17. 11.
SELECT EXTRACT(MONTH FROM '2003-01-02 10:30:00.000123');
14. 17. 12.
SELECT EXTRACT(QUARTER FROM '2003-01-02 10:30:00.000123');
14. 17. 13.
SELECT EXTRACT(SECOND_MICROSECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 14.
SELECT EXTRACT(MINUTE_MICROSECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 15.
SELECT EXTRACT(MINUTE_SECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 16.
SELECT EXTRACT(HOUR_MICROSECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 17.
SELECT EXTRACT(HOUR_SECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 18.
SELECT EXTRACT(HOUR_MINUTE FROM '2003-01-02 10:30:00.000123');
14. 17. 19.
SELECT EXTRACT(DAY_MICROSECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 20.
SELECT EXTRACT(DAY_SECOND FROM '2003-01-02 10:30:00.000123');
14. 17. 21.
SELECT EXTRACT(DAY_HOUR FROM '2003-01-02 10:30:00.000123');
www.java2java.com
|
Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.