草庐IT

datetime-parsing

全部标签

php - 在我的 MVC 框架中解析错误 : parse error, 期望 `T_FUNCTION'

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭9年前。我正在关注CreateyourFirstTinyMVCBoilerplatewithPHP教程,据我所知——我的代码与Jeff的代码相同……但我收到此错误:Parseerror:parseerror,expecting`T_FUNCTION'inD:\wamp\www\MVC_test\application\load.phponline8load.php

php - 使用 PHP 的 DateTime 警告

这个问题在这里已经有了答案:"date():Itisnotsafetorelyonthesystem'stimezonesettings..."(25个答案)关闭6年前。我有这个代码:try{$datetime1=newDateTime("now");$datetime2=newDateTime("now");$interval=$datetime1->diff($datetime2);var_dump($interval);}catch(Exception$e){echo$e->getMessage();}我没有看到关于var_dump的任何结果,php的输出是:DateTime::

php - 使用 DateTime 字符串对数组进行排序?

我如何在PHP中根据end_time值对这个数组(最近的项目排在第一位)进行高效排序?array0=>array'value'=>int4'end_time'=>string'2012-01-20T08:00:00+0000'(length=24)1=>array'value'=>int0'end_time'=>string'2012-01-21T08:00:00+0000'(length=24)2=>array'value'=>int5'end_time'=>string'2012-01-22T08:00:00+0000'(length=24)3=>array'value'=>int

PHP:带时区的 DateTime::createFromFormat()

我想将日期形式从d/m/Y转换为具有时区偏移量的Y-m-d。我可以使用以下代码将d/m/Y转换为Y-m-d:$date=DateTime::createFromFormat('d/m/Y',$date);$date=$date->format('Y-m-d');但我不确定如何添加时区偏移量。 最佳答案 (PHP5>=5.3.0)你实际上输入了第三个参数publicstaticDateTimeDateTime::createFromFormat(string$format,string$time[,DateTimeZone$timez

日期之间的 PHP DateTime 差异问题

$start=newDateTime('2014-01-07',newDateTimeZone('UTC'));$end=clone$start;$start->sub(newDateInterval('P1M'));//substractonemonthecho$start->format('Y-m-d').'-'.$end->format('Y-m-d');//2013-12-07-2014-01-07-seemscorrect,let'sgetnumberofdays...print_r($end->diff($start));//DateIntervalObject([y]=>

php - Symfony + Doctrine Oracle DateTime 格式问题

我在Symfony2.7+Doctrine中遇到OracleDateTime类型的问题。我有一个带有DateTime列的表,它通过Doctrine在Symfony中映射。当我尝试保留相关实体时,出现以下错误:Couldnotconvertdatabasevalue"31-MAY-1603.56.49.000000PM"toDoctrineTypedatetime.Expectedformat:Y-m-dH:i:sFile:.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/ConversionException.phpLine:63我无法更

PHP Magento SOAP-错误 : Parsing WSDL: Couldn't load from urlpath

我正在尝试通过传递托管在我的本地计算机上的url、我的开发环境来创建soap客户端,但我不断收到此错误。我曾经能够调用这个电话,而且效果很好。基本上我所做的就是这个$client=newSoapClient('http://virtual.website.com:81/api/?wsdl');如果我在浏览器中访问url,它就会出现,所以我知道这是正确的位置。在Magento论坛上有一些类似的帖子,但我不知道这是Magento特有的问题。他们提到的一切都是我已经拥有的解决方案。他们说要编辑主机文件,例如127.0.0.1website.com我已经有了这个,因为它被设置为虚拟主机。这是我

php - 无法解决此错误:调用未定义的方法 DateTime::createFromFormat()

我正在尝试在php中转换日期格式。以下代码会产生持久性错误$myDate="31/12/1980";$myDateTime=DateTime::createFromFormat('d/m/Y',"$myDate");$newDate=$myDateTime->format('dMY');echo$newDate;包含createFromFormat()的行不断产生错误:““调用未定义的方法”。我的测试Apache服务器和实际服务器都会发生这种情况,它们都运行PHP5.3+我是否需要包含或要求额外的文件?请帮忙-我只是php的中级水平。 最佳答案

php - SOAP 错误 : Parsing WSDL: Couldn't load from 'xxx/?wsdl' : Premature end of data in tag html line 1

几天来,我一直遇到错误,但无法找到解决此问题的方法。WSDLSOAP-ERROR:ParsingWSDL:Couldn'tloadfrom'http://www.domain.com/?wsdl':Prematureendofdataintaghtmlline1有关信息,这个wsdl在我们的生产环境中工作,当我试图让它在我的开发环境中工作时,我们遇到了这个错误。首先,我尝试用SOAPUI尝试这个文件,结果完全一样错误。我尝试用外部PHP脚本利用它,同样的错误。例如:$wsdl="http://www.domain.com/?wsdl";$service=newSoapclient($w

PHP Datetime 无法转换负 ISO8601 日期

用DateTime转换负日期让我出错测试代码var_dump(\DateTime::createFromFormat(\DateTime::ISO8601,'-0001-11-30T00:00:00+0100'));结果booleanfalse预期结果object(DateTime)[5]public'date'=>string'-0001-11-3000:00:00'(length=20)public'timezone_type'=>int1public'timezone'=>string'+01:00'(length=6)(或类似的东西)附言负日期字符串是用$d->format(\