WL#3616: Additional Date Translation Effects
Affects: Server-7.1
—
Status: Un-Assigned
The value of LC_TIME_NAMES affects output from DATE_FORMAT, DAYNAME, MONTHNAME. This task suggests additional ways to affect LC_TIME_NAMES, and additional functions affected by LC_TIME_NAMES. Translate AM/PM. DATE_FORMAT('%p') and DATE_FORMAT('%r') currently return 'AM' or 'PM'. They should return depending on LC_TIME_NAMES value. Bar has noticed that "man 1 date" says that %p and %P formats are blank in many locales, and suggests that should be the case for MySQL as well. Translate for STR_TO_DATE. STR_TO_DATE is currently unaffected by LC_TIME_NAMES. It should accept depending on LC_TIME_NAMES value. Since STR_TO_DATE is the reverse of DATE_FORMAT, this will make round trips easier. Also, STR_TO_DATE should be extended to accept a locale name as an additional argument. Extend GET_FORMAT. GET_FORMAT is currently unaffected by LC_TIME_NAMES. Examples: - to understand locale names: GET_FORMAT(DATE,'en_US') - to skip the second argument: GET_FORMAT(DATE) which should be short for: GET_FORMAT(DATE,@@lc_time_names) Add a new statement: SHOW LOCALE [LIKE 'string']; This would list all the locale names from sql_locale.cc, at least. A descriptive column (the features of the locale) is feasible too. Allow mysqld command-line option. Usually a server variable can be on the command line, as the MySQL Reference Manual says: "You can assign a value to a server system variable by using an option of the form --var_name=value. For example, --key_buffer_size=32M sets the key_buffer_size variable to a value of 32MB." and "System variable values can be set globally at server startup by using options on the command line or in an option file." Therefore allow: mysqld --lc_time_names=en_US This has the same effect as SET GLOBAL lc_time_names='en_US'. An additional possibility is: mysqld --lc-time-names=en_US Paul believes this is appropriate. Translate day suffix. DATE_FORMAT('%D') currently returns -- quoting the MySQL Reference Manual -- "%D Day of the month with English suffix (0th, 1st, 2nd, 3rd, …)". It should return depending on LC_TIME_NAMES value. References ---------- Oracle: http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10749/ch3globenv.htm#i1006894 SQL Server: http://msdn2.microsoft.com/en-us/library/ms174398.aspx WL#2928 (SECRET)
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.