Since mysql Generated Column
can't use FROM_UNIXTIME()
as generate sql, how can I convert a unix time to GMT+8 human readable date? My failed example:
ALTER TABLE just_a_table
ADD COLUMN created_date
CHAR(5)
GENERATED ALWAYS
AS (FROM_UNIXTIME(created_at, "%m/%d"))
STORED;
???
FROM_UNIXTIME()
is deterministic function. It can be used in generated column expression easily.db<>fiddle here