【问题标题】:Convert this date string to DATETIME or TIMESTAMP with PHP使用 PHP 将此日期字符串转换为 DATETIME 或 TIMESTAMP
【发布时间】:2013-05-16 20:37:06
【问题描述】:

我正在使用 Beanstream 支付 API,响应以以下日期格式返回:

5/21/2013 3:51:28 PM

使用 PHP 将其转换为 TIMESTAMP 或 DATETIME 的最佳方法是什么?

【问题讨论】:

  • strtotime($yourDateTimeString); ?它会给你一个 10 位的整数。如果你想约会,那就date('date-format-here', strtotime($yourDateTimeString));

标签: php mysql database datetime


【解决方案1】:

查看thisthisthis,了解如何在 PHP 中解析、创建和格式化日期/时间。

如果你赶时间,这会起作用:

strftime('%Y-%m-%d %H:%M:%S', strtotime('5/21/2013 3:51:28 PM'))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-10
    • 2011-08-23
    • 1970-01-01
    • 2013-05-04
    • 2018-03-27
    • 1970-01-01
    • 1970-01-01
    • 2020-05-24
    相关资源
    最近更新 更多