Date and Time Functions
932
timestamp value.
FROM_UNIXTIME()
[923]
will map that value back to only one of the original
TIMESTAMP
values. Here is an example, using
TIMESTAMP
values in the
CET
time zone:
mysql>
SELECT UNIX_TIMESTAMP('2005-03-27 03:00:00');
+---------------------------------------+
| UNIX_TIMESTAMP('2005-03-27 03:00:00') |
+---------------------------------------+
| 1111885200 |
+---------------------------------------+
mysql>
SELECT UNIX_TIMESTAMP('2005-03-27 02:00:00');
+---------------------------------------+
| UNIX_TIMESTAMP('2005-03-27 02:00:00') |
+---------------------------------------+
| 1111885200 |
+---------------------------------------+
mysql>
SELECT FROM_UNIXTIME(1111885200);
+---------------------------+
| FROM_UNIXTIME(1111885200) |
+---------------------------+
| 2005-03-27 03:00:00 |
+---------------------------+
If you want to subtract
UNIX_TIMESTAMP()
[931]
columns, you might want to cast the result to
signed integers. See
Section 12.10, “Cast Functions and Operators”
.
•
UTC_DATE
[932]
,
UTC_DATE()
[932]
Returns the current UTC date as a value in
'YYYY-MM-DD'
or
YYYYMMDD
format, depending on
whether the function is used in a string or numeric context.
mysql>
SELECT UTC_DATE(), UTC_DATE() + 0;
-> '2003-08-14', 20030814
•
UTC_TIME
[932]
,
UTC_TIME()
[932]
Returns the current UTC time as a value in
'HH:MM:SS'
or
HHMMSS.uuuuuu
format, depending on
whether the function is used in a string or numeric context.
mysql>
SELECT UTC_TIME(), UTC_TIME() + 0;
-> '18:07:53', 180753.000000
•
UTC_TIMESTAMP
[932]
,
UTC_TIMESTAMP()
[932]
Returns the current UTC date and time as a value in
'YYYY-MM-DD HH:MM:SS'
or
YYYYMMDDHHMMSS.uuuuuu
format, depending on whether the function is used in a string or numeric
context.
mysql>
SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;
-> '2003-08-14 18:08:04', 20030814180804.000000
•
WEEK(date[,mode])
[932]
This function returns the week number for
date
. The two-argument form of
WEEK()
[932]
enables you to specify whether the week starts on Sunday or Monday and whether the return value
should be in the range from
0
to
53
or from
1
to
53
. If the
mode
argument is omitted, the value of
the
default_week_format
[446]
system variable is used. See
Section 5.1.4, “Server System
Variables”
.
The following table describes how the
mode
argument works.
Mode
First day of week Range
Week 1 is the first week …
0
Sunday
0-53
with a Sunday in this year
1
Monday
0-53
with more than 3 days this year
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...