search

Home  >  Q&A  >  body text

php - SELECT FROM_UNIXTIME(created, `'%Y-%m-%d'` ) AS day

$this->db->select("FROM_UNIXTIME(created, '%Y-%m-%d' )  AS day")

......
The result of

ci is:

SELECT FROM_UNIXTIME(created, `'%Y-%m-%d'` ) AS day

How to avoid mysql’s timestamp function by adding the `` symbol

高洛峰高洛峰2779 days ago691

reply all(3)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-05 11:11:02

    Can you try escaping the single quotes

    reply
    0
  • 怪我咯

    怪我咯2017-06-05 11:11:02

        
        $this->db->select('FROM_UNIXTIME(created, "%Y-%m-%d" )  AS day');

    reply
    0
  • PHP中文网

    PHP中文网2017-06-05 11:11:02

    $this->db->select("from_unixtime(created,'%Y-%m-$d') as day",false)

    Add false parameter

    reply
    0
  • Cancelreply