php时间函数

1:

设置时区:date_default_timezone_set('Asia/ShangHai');

2:   时间函数 date()

date ( string $format [, int $timestamp ] )

format:必需。规定时间的格式。Y-m-d H:i:s;

3.时间函数 time()

time()返回当前时间时间戳函数返回自 Unix 纪元(January 1 1970 00:00:00 GMT)起的当前时间的秒数

4。时间函数 strtotime();

 

strtotime(string $time [, int $now = time() ])将任何字符串的日期时间描述解析为 Unix 时间戳

 

time:必需。规定日期/时间字符串。

 

now:可选。规定用来计算返回值的时间戳。

 

strtotime('+1day', 1575158400);

 

strtotime(‘2020-2-28’)

 

 

数据库存时间戳,显示的时候显示正常时间

 

posted on 2020-06-16 09:44  vermouthmo  阅读(391)  评论(0)    收藏  举报

导航