MySQL中 Bigint类型无法通过year函数直接转换

MySQL中 Bigint类型无法通过year函数直接转换,需要通过FROM_UNIXTIME(create_date/1000)转换成Date

    year(FROM_UNIXTIME(create_date/1000))

测试:

      select year(FROM_UNIXTIME(create_date/1000)) as year ,
              month(FROM_UNIXTIME(create_date/1000)) as month,
              count(*) as count
      from ms_article group by year,month;
posted @ 2022-03-03 19:42  weiambt  阅读(114)  评论(0)    收藏  举报