Mysql Server Locale Support - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

mysql>
INSERT INTO t1 (a) VALUES (2);
Query OK, 1 row affected (0.00 sec)
mysql>
-- values differ internally but display the same
mysql>
SELECT a, ts, UNIX_TIMESTAMP(ts) FROM t1;
+------+---------------------+--------------------+
| a
| ts
+------+---------------------+--------------------+
|
1 | 2008-12-31 23:59:59 |
|
2 | 2008-12-31 23:59:59 |
+------+---------------------+--------------------+
2 rows in set (0.00 sec)
mysql>
-- only the non-leap value matches
mysql>
SELECT * FROM t1 WHERE ts = '2008-12-31 23:59:59';
+------+---------------------+
| a
| ts
+------+---------------------+
|
1 | 2008-12-31 23:59:59 |
+------+---------------------+
1 row in set (0.00 sec)
mysql>
-- the leap value with seconds=60 is invalid
mysql>
SELECT * FROM t1 WHERE ts = '2008-12-31 23:59:60';
Empty set, 2 warnings (0.00 sec)
To work around this, you can use a comparison based on the UTC value actually stored in column,
which has the leap second correction applied:
mysql>
-- selecting using UNIX_TIMESTAMP value return leap value
mysql>
SELECT * FROM t1 WHERE UNIX_TIMESTAMP(ts) = 1230768000;
+------+---------------------+
| a
| ts
+------+---------------------+
|
2 | 2008-12-31 23:59:59 |
+------+---------------------+
1 row in set (0.00 sec)

10.7. MySQL Server Locale Support

Beginning with MySQL 5.0.25, the locale indicated by the
controls the language used to display day and month names and abbreviations. This variable affects
the output from the
functions.
lc_time_names
function.
Locale names have language and region subtags listed by IANA
language-subtag-registry) such as
your system's locale setting, but you can set the value at server startup or set the
have the
SUPER
value to affect the locale for its own connection.
SESSION
mysql>
SET NAMES 'utf8';
Query OK, 0 rows affected (0.09 sec)
mysql>
SELECT @@lc_time_names;
+-----------------+
| @@lc_time_names |
+-----------------+
| en_US
+-----------------+
1 row in set (0.00 sec)
mysql>
SELECT DAYNAME('2010-01-01'), MONTHNAME('2010-01-01');
+-----------------------+-------------------------+
MySQL Server Locale Support
| UNIX_TIMESTAMP(ts) |
|
|
[921],
DATE_FORMAT()
[462]
does not affect the
'ja_JP'
[578]
privilege. Any client can examine the value of
|
1230767999 |
1230768000 |
lc_time_names
[923], and
DAYNAME()
[927]
STR_TO_DATE()
(http://www.iana.org/assignments/
or 'pt_BR'. The default value is
821
[462]
system variable
[926]
MONTHNAME()
or
[924]
GET_FORMAT()
regardless of
'en_US'
GLOBAL
[462]
lc_time_names
value if you
or set its

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents