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 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题