Home  >  Article  >  Backend Development  >  UNIX时间戳

UNIX时间戳

WBOY
WBOYOriginal
2016-06-23 13:57:23740browse

数据库中是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存储时间最好还是用日期根式

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn