Php 将日期转换为ISO格式的sql server

Php 将日期转换为ISO格式的sql server,php,sql-server-2008,sql-server-2005,date-format,iso,Php,Sql Server 2008,Sql Server 2005,Date Format,Iso,我有过这样的约会$input='19/02/2013' 如何在表格中插入此日期(ISO 8601格式) 平台是SQLServer2005或SQLServer2008。我认为这应该可以做到 $dt = new DateTime(strtotime($input)); echo $dt->format(DateTime::ISO8601); 您需要使用一些php函数来转换为sqlserver日期格式 $input = 19/02/2013; $new_date = explode('/',$

我有过这样的约会
$input='19/02/2013'

如何在表格中插入此日期(ISO 8601格式)


平台是SQLServer2005或SQLServer2008。

我认为这应该可以做到

$dt = new DateTime(strtotime($input));
echo $dt->format(DateTime::ISO8601);

您需要使用一些php函数来转换为sqlserver日期格式

$input = 19/02/2013;
$new_date = explode('/',$input);
$date = $new_date[2]-$new_date[1]-$new_date[0];
对于ISO格式,您可以这样使用

$date->format(DateTime::ISO8601);

$newdate=date('Y-m-d',strotime(str_replace('/','-',$input));/*格式化iSO..*/但我尝试在表中插入此日期时出错…]从字符串转换日期和/或时间时转换失败。))他们声称的主题是重复的,似乎为不受支持的PHP版本提供了一个解决方案,下面提供的解决方案比另一个主题更新,也更好。