doufunuo4787 2015-12-31 22:26
浏览 86

DST和PHP日期和时间戳

I have searched the list for an prior answer, but can't find one. We are using PHP 4.4.8 and need a PHP 4 answer. We have an array of timestamps [$d] representing:

1478404800 2016-11-06 00:00:00

1478494800 2016-11-07 00:00:00

2016-11-06 is the transition day for DST to Std time.

We want to store a timestamp that represents 1:00pm on each day, so we did

$e2 = $d+46800

46800 is 13 hours worth of seconds.

date("D d M Y g a I",$e2)

returns:

Sun 06 Nov 2016 12 pm 0

Mon 07 Nov 2016 1 pm 0

The trailing 0 is the DST indicator. Nov 6 seems to be indicating the DST to STD "fallback" 1 hour. We don't want DST reflected.

So the questions are:

  1. How do we get a Nov 6th answer that doesn't reflect DST to STD.

  2. If this is DST, why for one day? Nov 7th didn't get any "fallback"

Users are not in different time zones, so we needn't worry about time zones.

  • 写回答

1条回答 默认 最新

  • douxing5199 2016-04-07 13:48
    关注

    It's unclear what you're asking for exactly, but if your only concern is the date() return value - tell PHP to create the correct UNIX timestamp:

    mktime(13, 0, 0, 11, 6, 2016);
    

    Though, I'd be more concerned that you're still running PHP 4 on this date.

    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制