草庐IT

timezone_offset

全部标签

php - 解析位置41时间字符串失败(i) : Double timezone specification

我正在使用jquerydaterangepicker,它又使用jQuerydatapicker.我的Ubuntu系统运行良好。浏览器正在发送一个可解析的字符串:$dateStarted=new\DateTime($post['startDate']);//ThuNov15201200:00:00GMT-0700(MST)print_r($dateStarted);输出:DateTimeObject([date]=>2012-11-1500:00:00[timezone_type]=>1[timezone]=>-07:00)在我们的测试人员Windows系统上,浏览器在字符串中发送扩展时

php - 无法在 php.ini 文件中设置 date.timezone

我正在使用php5.5,每当我在PHP中使用日期函数时都会收到此错误:Warning:phpinfo():Itisnotsafetorelyonthesystem'stimezonesettings.Youare*required*tousethedate.timezonesettingorthedate_default_timezone_set()function.Incaseyouusedanyofthosemethodsandyouarestillgettingthiswarning,youmostlikelymisspelledthetimezoneidentifier.Wes

codeigniter - 如何为 CodeIgniter 设置 date.timezone 以使用 php 5.3

当php.ini中的date.timezone被注释掉时,它会给我:APHPErrorwasencounteredSeverity:WarningMessage:main():Itisnotsafetorelyonthesystem'stimezonesettings.Youarerequiredtousethedate.timezonesettingorthedate_default_timezone_set()function.Incaseyouusedanyofthosemethodsandyouarestillgettingthiswarning,youmostlikelymi

php - preg_match() : Compilation failed: invalid range in character class at offset

提前感谢您抽出宝贵时间帮助解决此问题。preg_match():Compilationfailed:invalidrangeincharacterclassatoffset20session.phponline278在我们的服务器上进行PHP升级后,这在工作了几个月后突然停止工作。这里是代码else{/*Spruceupusername,checklength*/$subuser=stripslashes($subuser);if(strlen($subuser)setError($field,"*Usernamebelow".$config['min_user_chars']."ch

php - 如何在不检查数组的每个字段的情况下避免 PHP Notice "Undefined offset: 0"

我有以下数组:$keyvisual_data=array('video_file'=>$row->field_field_video[0]['rendered']['#item']['uri'],'bild_file'=>$row->field_field_bild[0]['rendered']['#item']['uri'],'subline_src'=>$row->_field_data['nid']['entity']->field_key_titel['und'][0]['safe_value'],'screenreader_src'=>$row->field_field_al

PHP 正则表达式 : what is "class at offset 0"?

我正在尝试使用简单的正则表达式和phppreg_replace函数从字符串中删除所有标点符号,但出现以下错误:Compilationfailed:POSIXnamedclassesaresupportedonlywithinaclassatoffset0我想这意味着我不能在偏移量0的类之外使用POSIX命名类。我的问题是,当它说“在偏移量0的类内”时是什么意思?$string="Ilike:perl";if(eregi('[[:punct:]]',$string))$new=preg_replace('[[:punct:]]','',$string);echo$new;

php - DateTime 对象上的不同 timezone_types

我在Postgres上使用Doctrine2。在一张表中,我有两种不同的日期类型:birthdate:date和created_at:datetimetz。两者都成为DateTime对象,但具有不同的timezone_type。以下是list:created_atdatetimetz:DateTimeObject([date]=>2013-04-1811:54:34[timezone_type]=>1[timezone]=>+02:00)生日日期:DateTimeObject([date]=>1970-01-0100:00:00[timezone_type]=>3[timezone]=

php - undefined offset PHP错误

我在PHP中收到以下错误Noticeundefinedoffset1:inC:\wamp\www\includes\imdbgrabber.phpline36这是导致它的PHP代码:错误是什么意思? 最佳答案 如果preg_match没有找到匹配项,$matches是一个空数组。所以你应该在访问$matches[0]之前检查preg_match是否找到了匹配,例如:functionget_match($regex,$content){if(preg_match($regex,$content,$matches)){return$ma

php - 用 TimeZones 填充 <SELECT> 框的最佳方法

我需要将时区选择器显示为用户控件,这似乎总是比实际上更容易。在内部,我使用DateTimeZone标识符存储所有内容,因为这似乎是获得所需准确度水平的最明智的方式,因为该项目连接了与地面媒体相关的现实世界时间。我不想做的是显示一个包含300多个时区的选择框,我也不想使用“UTC-8”之类的东西创建伪造的时区偏移量(它不仅会丢失DST信息,还会丢失实际的DST所在的日期)。最后,我需要一个选项,其中包含正确的TZD标识符,类似这样(括号中的#s不是必需的,仅用于潜在的最终用户说明):LosAngeles[UTC-7|DST]...有没有人对建立这个列表有任何建议?我用谷歌搜索的所有解决方

PHP & MySQL : Converting Stored TIMESTAMP into User's Local Timezone

所以我有一个具有评论功能的站点,其中评论的时间戳存储在MySQL数据库中。据我了解,时间戳在存储时转换为UTC,然后在检索时转换回默认时区。就我而言,我的服务器位于中央夏令时时区(CDT)。我计划通过输入表单从每个用户那里获取时区。我只是想知道如何将TIMESTAMP值转换为用户的时区。首先,我会从UTC转换为本地时区吗?或CDT到本地时区?其次,我将如何在PHP中执行此操作?我会这样做吗:$userTimezone=newDateTimeZone($userSubmittedTimezoneString);$myDateTime=newDateTime($storedTimestam