【问题标题】:How to get strtotime() with written time format?如何以书面时间格式获取 strtotime()?
【发布时间】:2013-02-04 04:52:27
【问题描述】:

我需要输入 09 hours 20 minutes 到 strtotime 并获取相应的时间戳。我试过了,strtotime("09 hours 20 minutes",0) 但它只给了我当天的时间,以秒为单位。即33600

我需要获取确切的时间戳。即从1-1-1970 到当天09:20 的时间以秒为单位。到底有没有?任何帮助将不胜感激。

【问题讨论】:

  • 你试过什么?您是否尝试添加“今天”的00:00 midnight 的时间戳?
  • 我试过strtotime("09 hours 20 minutes",0)。我试图摆脱:strtotime中的时间分隔符。
  • "09 hours 20 minutes" 从什么时候开始?今天午夜?
  • 我需要从1-1-1970 开始,但strtotime("09 hours 20 minutes",0) 从今天午夜开始只给12:00am
  • 甚至strtotime("09 hours 20 minutes", strtotime("today"));

标签: php timestamp strtotime


【解决方案1】:

就像王在第一条评论中所说: 使用“今天”作为偏移量

strtotime("09 hours 20 minutes", strtotime("today"));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    • 1970-01-01
    • 1970-01-01
    • 2019-12-22
    相关资源
    最近更新 更多