与日期值一样,MySQL还允许我们使用宽松的格式表示时间。我们可以在时间部分之间使用任何标点符号作为分隔符。一些示例如下-
mysql> Select timestamp('2017-10-20 04+05+36'); +----------------------------------+ | timestamp('2017-10-20 04+05+36') | +----------------------------------+ | 2017-10-20 04:05:36 | +----------------------------------+ 1 row in set (0.00 sec) mysql> Select timestamp('2017-10-20 04*05*36'); +----------------------------------+ | timestamp('2017-10-20 04*05*36') | +----------------------------------+ | 2017-10-20 04:05:36 | +----------------------------------+ 1 row in set (0.00 sec) mysql> Select timestamp('2017-10&20 04@05+36'); +----------------------------------+ | timestamp('2017-10&20 04@05+36') | +----------------------------------+ | 2017-10-20 04:05:36 | +----------------------------------+ 1 row in set (0.00 sec) mysql> Select timestamp('2017*10@20 04*05*36'); +----------------------------------+ | timestamp('2017*10@20 04*05*36') | +----------------------------------+ | 2017-10-20 04:05:36 | +----------------------------------+ 1 row in set (0.00 sec)