mysql日期格式化

mysql表中字段event_time是时间戳格式,希望查询结果以固定格式展示,因此需要使用data_format。

具体使用方法如下:

 

select
  id,
  user_id,
  site_id,
  customer,
  domain_id,
  ip,
  page,
  operation,
  type,
  client,
  app,
  date_format(event_time, '%Y-%m-%d') as optime,
  count(event_time)  as c
FROM
  user_log
where
  customer = '4aa3d34a3f5a4f4a801d466f8040fc32'
  group by event_time

 

posted @ 2018-03-29 17:49  xwdreamer  阅读(422)  评论(0编辑  收藏  举报