Heim  >  Artikel  >  Backend-Entwicklung  >  UNIX时间戳

UNIX时间戳

WBOY
WBOYOriginal
2016-06-23 13:57:23739Durchsuche

数据库中是UNIX时间戳,PHP如何取出当天的所有信息?


回复讨论(解决方案)

getdate -- 取得日期/时间信息
说明
array getdate ( [int timestamp] )
返回一个根据 timestamp 得出的包含有日期信息的结合数组。如果没有给出时间戳则认为是当前本地时间。

你的意思是你的一个字段存储的是时间戳,如果是的话我们这样来做:
[code=php
]$today = date('Y-m-d');
$startTime = strtotime($today); //今天凌晨时间戳
$endTime   = $startTime+24*3600;//明天凌晨时间戳
$sql       = "select * from table where time between $startTime and $endTime";
//执行sql
[/code]
但是不知道效率如何,给你一个建议,根据高性能Mysql存储时间最好还是用日期根式

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn