Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP将此日期字符串转换为日期时间或时间戳_Php_Mysql_Database_Datetime - Fatal编程技术网

使用PHP将此日期字符串转换为日期时间或时间戳

使用PHP将此日期字符串转换为日期时间或时间戳,php,mysql,database,datetime,Php,Mysql,Database,Datetime,我正在使用Beanstream支付API,响应返回以下日期格式: 5/21/2013 3:51:28 PM 为了使用PHP将其存储为MySQL中的时间戳或日期时间,最好的转换方法是什么?了解如何在PHP中解析、创建和格式化日期/时间 如果您赶时间,这将起作用: strftime('%Y-%m-%d %H:%M:%S', strtotime('5/21/2013 3:51:28 PM')) strotime($yourDateTimeString)?它会给你一个10位数的整数。如果您想要一个日

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

5/21/2013 3:51:28 PM
为了使用PHP将其存储为MySQL中的时间戳或日期时间,最好的转换方法是什么?

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

如果您赶时间,这将起作用:

strftime('%Y-%m-%d %H:%M:%S', strtotime('5/21/2013 3:51:28 PM'))
strotime($yourDateTimeString)?它会给你一个10位数的整数。如果您想要一个日期,那么只需
date('date-format-here',strottime($yourDateTimeString))