我将日期存储为VARCHAR(10)。我想选择时间戳
SELECT CAST (date AS TIMESTAMP) AS created_timestamp
FROM dates;
我明白了:
Incorrect parameters in the call to stored function 'CAST': SELECT CAST (date AS TIMESTAMP) AS created_timestamp FROM dates
我做错了什么?
答案 0 :(得分:0)
您无法转换为MySQL中的时间戳。有一个名为TIMESTAMP
的函数会为你做这件事。
SELECT TIMESTAMP(date) AS created_timestamp FROM dates;