0

我有以下日期变量,它被转换为Month, 10, 2012以亚利桑那时间显示:

$date = $_GET['date'];


$tzFromend = new DateTimeZone('America/New_York'); 
$tzToend = new DateTimeZone('America/Phoenix'); 


    $dtend = new DateTime($date, $tzFromend); 
    $dtend->setTimezone($tzToend);


$dtend->format('F j, Y');

在下面的查询中,e.time是一个时间戳。我想修改下面的查询以包含与$date亚利桑那时间具有相同日历日期的所有值。

我怎么能这样做?

$sqlStrend = "SELECT e.loginid, e.time, e.points, s.title
      FROM endorsements e
      JOIN submission s ON e.submissionid = s.submissionid
     WHERE e.loginid = '$idn' 
  ORDER BY e.time DESC
  LIMIT $offset, $rowsperpage";
4

1 回答 1

0

尝试这个:

$d = $dtend->format('c');

$sqlStrend = "SELECT e.loginid, e.time, e.points, s.title
  FROM endorsements e
  JOIN submission s ON e.submissionid = s.submissionid
 WHERE e.loginid = '$idn' AND DATE(e.time) = DATE($d)
 ORDER BY e.time DESC
 LIMIT $offset, $rowsperpage";
于 2012-06-16T01:49:01.827 回答