mysql日期格式化

mysql表中字段event_time是時間戳格式,但願查詢結果以固定格式展現,所以須要使用data_format。mysql

具體使用方法以下:sql

 

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
相關文章
相關標籤/搜索