convert unix timestamp php

前端 未结 5 432
你的背包
你的背包 2021-01-13 12:14

I have a database that stores the time for me. I insert it from PHP using

date( \'Y-m-d H:i:s\');

I then use this function to convert it t

5条回答
  •  情话喂你
    2021-01-13 13:09

    If you're using mysql, it has a DATE_FORMAT function. You can call it like

    SELECT DATE_FORMAT(`datefield`, "%Y%m%d%H%i%s") AS `date_formatted` FROM table;
    

    So you get an already formatted date from your database.

提交回复
热议问题