Oracle 5.0 Reference Manual page 946

Table of Contents

Advertisement

mysql>
SELECT MONTH('2008-02-03');
-> 2
MONTHNAME(date)
Returns the full name of the month for date. As of MySQL 5.0.25, the language used for the name is
controlled by the value of the
Locale
Support").
mysql>
SELECT MONTHNAME('2008-02-03');
-> 'February'
[926]
NOW()
Returns the current date and time as a value in
YYYYMMDDHHMMSS.uuuuuu
context. The value is expressed in the current time zone.
mysql>
SELECT NOW();
-> '2007-12-15 23:50:26'
mysql>
SELECT NOW() + 0;
-> 20071215235026.000000
[926]
returns a constant time that indicates the time at which the statement began to
NOW()
execute. (Within a stored function or trigger,
triggering statement began to execute.) This differs from the behavior for
returns the exact time at which it executes as of MySQL 5.0.12.
mysql>
SELECT NOW(), SLEEP(2), NOW();
+---------------------+----------+---------------------+
| NOW()
+---------------------+----------+---------------------+
| 2006-04-12 13:47:36 |
+---------------------+----------+---------------------+
mysql>
SELECT SYSDATE(), SLEEP(2), SYSDATE();
+---------------------+----------+---------------------+
| SYSDATE()
+---------------------+----------+---------------------+
| 2006-04-12 13:47:44 |
+---------------------+----------+---------------------+
In addition, the
SET TIMESTAMP
not by
[928]. This means that timestamp settings in the binary log have no effect
SYSDATE()
on invocations of
SYSDATE()
subsequent invocation of
this effect so that
NOW()
See the description for
the two functions.
PERIOD_ADD(P,N)
Adds
months to period
N
Note that the period argument
mysql>
SELECT PERIOD_ADD(200801,2);
-> 200803
PERIOD_DIFF(P1,P2)
Returns the number of months between periods
or YYYYMM. Note that the period arguments
mysql>
SELECT PERIOD_DIFF(200802,200703);
Date and Time Functions
[926]
lc_time_names
format, depending on whether the function is used in a string or numeric
| SLEEP(2) | NOW()
0 | 2006-04-12 13:47:36 |
| SLEEP(2) | SYSDATE()
0 | 2006-04-12 13:47:46 |
statement affects the value returned by
[928]. Setting the timestamp to a nonzero value causes each
[926]
to return that value. Setting the timestamp to zero cancels
NOW()
[926]
once again returns the current date and time.
[928]
for additional information about the differences between
SYSDATE()
[926]
(in the format
P
YYMM
is not a date value.
P
[926]
P1
926
[462]
system variable
'YYYY-MM-DD HH:MM:SS'
[926]
returns the time at which the function or
NOW()
|
|
or YYYYMM). Returns a value in the format YYYYMM.
and P2.
and
P1
P1
and
are not date values.
P2
(Section 10.7, "MySQL Server
or
[928], which
SYSDATE()
[926]
but
NOW()
should be in the format
P2
YYMM

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents