草庐IT

input-datetime

全部标签

php - Codeigniter $this->input->post 始终为 FALSE

我正在尝试将httpRequest发送到codeigniterController函数。我正在使用REST控制台来测试该功能。我正在尝试发送3POST变量。用户名电子邮件用户名这是处理请求的代码publicfunctionNewUser(){if($this->input->post()){$FID=$this->input->post('UserID');$UserName=$this->input->post('UserName');$Email=$this->input->post('Email');echo"working";echo$FID;echo$UserName;}el

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 - 无法解决此错误:调用未定义的方法 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 - 更新 max_input_vars 后仍收到 "Input Variables Exceeded 1000"错误

我正在运行Magento,我收到“mod_fcgid:stderr:PHPWarning:Unknown:Inputvariablesexceeded1000.Toincreasethelimitchangemax_input_varsinphp.ini.inUnknownonline0”试图保存相关数据库中包含5000多种产品的产品。大多数人建议尝试通过将max_input_vars更新为更高的值来解决此问题。我继续将max_input_vars=100000添加到php.ini,并将php_valuemax_input_vars100000添加到.htaccess以获得良好的衡量标

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(\

php - Symfony2 : How to set default value for a field DateTime

我使用Symfony2.8我有一个名为“Docentes”的表,其中包含一个日期时间字段“fechaAlta”我需要在添加新记录时此字段的默认值为“今天”我生成CRUD,使用命令generate:doctrine:crud在文件“DocentesController.php”中,Symfony创建了两个函数:“newAction”和“editAction”(以及其他函数)。两者都使用相同的表单,将“DocentesType.php”文件插入“表单”文件夹中:publicfunctionbuildForm(FormBuilderInterface$builder,array$option