Strtotime在某些日期提前一小时?

时间:2015-10-21 17:34:29

标签: php date unix-timestamp

为什么strtotime()上的某些日期有我们的进展?

我有一个代码(这是某些日期的正确输出,请参阅说明):

$date =  strtotime($_POST['date'])-3600;
$date35 = $date*1000;

可以正常转换到我的时区,但是从25到31个月的日期(我已经观察到),提前一小时?但是在月份的日期低于25或24以下的时候,小时还可以吗?

我试图操纵购买添加公式,但它会影响24天以下的其他行,我该怎么办?

但是,我可以使用以下代码操作My DATA TABLE上的显示:

 date('F j, Y'.' - '.' h:i A', $d / 1000+3600)

那么显示就可以作为回声,但是按时,提前一小时,我可以将日期转换为与上面代码相​​反的时间戳吗?

无论如何,我必须使用毫秒,因为我使用https://github.com/Serhioromano/bootstrap-calendar作为我的日历。

这是我的完整代码:

<?php include('connect.php');
include('session.php'); ?>
{
"success": 1,
"result": [
        <?php
        $event_query = mysql_query("SELECT * FROM appointment,user,branch,service where user.user_id = appointment.user_id and appointment.branch_id = branch.branch_id and service.service_id = appointment.service_id  and appointment.appoint_date != (SELECT MAX(appointment.appoint_date) FROM appointment where appointment.branch_id = '$session_branchid')  and appointment.appoint_status='Pending' and appointment.branch_id = $session_branchid")or die(mysql_error());
          while($event_row = mysql_fetch_array($event_query)){
          $date = date($event_row['appoint_date']);

          $datee = date($event_row['end']);

          $uid = $event_row['user_id'];
          $appid = $event_row['appointment_id'];
          ?>
    {
        "id": "<?php echo $appid; ?>",
        "title": "<?php echo $event_row['firstname'].' '.$event_row['lastname']; ?>",
        "url": "client_appointment_modal.php?id=<?php echo $uid; ?>&si=<?php echo $event_row['service_id']; ?>",
        "class": "event-success",
        "start": "<?php echo  $date; ?>",
        "end":   "<?php echo $datee; ?>"
    }, 
    <?php }; ?>
    <?php
        $event_query2 = mysql_query("SELECT * FROM appointment,user,branch,service where user.user_id = appointment.user_id and appointment.branch_id = branch.branch_id and service.service_id = appointment.service_id and appointment.appoint_status='Pending'  and appointment.branch_id = '$session_branchid' order by appointment.appoint_date desc limit 1")or die(mysql_error());
          while($event_row2 = mysql_fetch_array($event_query2)){
          $date = date($event_row2['appoint_date']);

          $datee = date($event_row2['end']);

          $uid2 = $event_row2['user_id'];
          $appid = $event_row2['appointment_id'];
          ?>
    {
        "id": "<?php echo $event_row2['appointment_id']; ?>",
        "title": "<?php echo $event_row2['firstname'].'  '.$event_row2['lastname']; ?>",
        "url": "client_appointment_modal.php?id=<?php echo $uid2; ?>&si= <?php echo $event_row2['service_id']; ?>",
        "class": "event-success",
        "start": "<?php echo  $date; ?>",
        "end":   "<?php echo $datee; ?>"
    }
    <?php }; ?>
]
}

这是输出: please see my output

我认为这是因为strtotime?如何解决?

0 个答案:

没有答案