Bug #85421 UNIX_TIMESTAMP() date argument description is incomplete
Submitted: 12 Mar 2017 23:10 Modified: 17 Mar 2017 13:53
Reporter: monty solomon Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[12 Mar 2017 23:10] monty solomon
The documentation for the UNIX_TIMESTAMP() function does not include formats with HHMMSS as part of the valid number formats that are accepted.

12.7 Date and Time Functions

If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD, optionally including a fractional seconds part. 

How to repeat:
mysql> SELECT UNIX_TIMESTAMP(170312165917), UNIX_TIMESTAMP(20170312165917)\G
*************************** 1. row ***************************
  UNIX_TIMESTAMP(170312165917): 1489352357
UNIX_TIMESTAMP(20170312165917): 1489352357

*************************** 1. row ***************************
                  NOW(): 2017-03-12 19:04:24
                NOW()+0: 20170312190424
UNIX_TIMESTAMP(NOW()+0): 1489359864

mysql> SELECT UNIX_TIMESTAMP(170312165917.123), UNIX_TIMESTAMP(20170312165917.123)\G
*************************** 1. row ***************************
  UNIX_TIMESTAMP(170312165917.123): 1489352357.123
UNIX_TIMESTAMP(20170312165917.123): 1489352357.123

mysql> SELECT NOW(3), NOW(3)+0, UNIX_TIMESTAMP(NOW(3)+0)\G
*************************** 1. row ***************************
                  NOW(3): 2017-03-12 19:07:51.016
                NOW(3)+0: 20170312190751.016
UNIX_TIMESTAMP(NOW(3)+0): 1489360071.016

Suggested fix:
Update the documentation to include YYMMDDHHMMSS and YYYYMMDDHHMMSS (with optional fractional part) as valid arguments to the UNIX_TIMESTAMP() function.
[13 Mar 2017 16:36] MySQL Verification Team
This is also, like 85420, a documentation bug.
[13 Mar 2017 21:01] monty solomon
The documentation update for bug #85420 addresses this bug too.
[17 Mar 2017 13:53] Paul DuBois
Posted by developer:
Docs updated. Closing.