summaryrefslogtreecommitdiff
path: root/Docs
diff options
context:
space:
mode:
authorunknown <paul@central.snake.net>2001-08-06 11:55:44 -0500
committerunknown <paul@central.snake.net>2001-08-06 11:55:44 -0500
commita8c230adebf205ca849829c840baf47a7ace4aa4 (patch)
tree291be57aa0788e7c0108ee1056caf55fbed529e4 /Docs
parentc67510f0939fbcad4f2f0efcc79272322d5ffa57 (diff)
downloadmariadb-git-a8c230adebf205ca849829c840baf47a7ace4aa4.tar.gz
manual.texi added explicit entry for EXTRACT() function
Docs/manual.texi: added explicit entry for EXTRACT() function
Diffstat (limited to 'Docs')
-rw-r--r--Docs/manual.texi26
1 files changed, 18 insertions, 8 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 256362850f0..015e23ec009 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -30531,7 +30531,7 @@ mysql> select PERIOD_DIFF(9802,199703);
@findex DATE_SUB()
@findex ADDDATE()
@findex SUBDATE()
-@findex EXTRACT(type FROM date)
+@findex EXTRACT()
@item DATE_ADD(date,INTERVAL expr type)
@itemx DATE_SUB(date,INTERVAL expr type)
@itemx ADDDATE(date,INTERVAL expr type)
@@ -30551,7 +30551,7 @@ or subtracted from the starting date. @code{expr} is a string; it may start
with a @samp{-} for negative intervals. @code{type} is a keyword indicating
how the expression should be interpreted.
-The @code{EXTRACT(type FROM date)} function returns the 'type'
+The related function @code{EXTRACT(type FROM date)} returns the 'type'
interval from the date.
The following table shows how the @code{type} and @code{expr} arguments
@@ -30605,12 +30605,6 @@ mysql> SELECT DATE_ADD("1998-01-01 00:00:00",
-> 1997-12-30 14:00:00
mysql> SELECT DATE_SUB("1998-01-02", INTERVAL 31 DAY);
-> 1997-12-02
-mysql> SELECT EXTRACT(YEAR FROM "1999-07-02");
- -> 1999
-mysql> SELECT EXTRACT(YEAR_MONTH FROM "1999-07-02 01:02:03");
- -> 199907
-mysql> SELECT EXTRACT(DAY_MINUTE FROM "1999-07-02 01:02:03");
- -> 20102
@end example
If you specify an interval value that is too short (does not include all the
@@ -30649,6 +30643,22 @@ mysql> select DATE_ADD('1998-01-30', Interval 1 month);
Note from the preceding example that the word @code{INTERVAL} and the
@code{type} keyword are not case sensitive.
+@findex EXTRACT()
+@item EXTRACT(type FROM date)
+
+The @code{EXTRACT()} function uses the same kinds of interval type
+specifiers as @code{DATE_ADD()} or @code{DATE_SUB()}, but extracts parts
+from the date rather than performing date arithmetic.
+
+@example
+mysql> SELECT EXTRACT(YEAR FROM "1999-07-02");
+ -> 1999
+mysql> SELECT EXTRACT(YEAR_MONTH FROM "1999-07-02 01:02:03");
+ -> 199907
+mysql> SELECT EXTRACT(DAY_MINUTE FROM "1999-07-02 01:02:03");
+ -> 20102
+@end example
+
@findex TO_DAYS()
@item TO_DAYS(date)
Given a date @code{date}, returns a daynumber (the number of days since year