- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个输入一组日期的表单,这些日期将用于 mysql 查询。与 mysql 查询一起使用时,日期必须是 $date
+1 天。它工作正常,除了服务器返回有关使用 date_default_timezone_set()
的警告。
//$date is date captured from an input form
$selected_date = date("Y-m-d", strtotime($date . "+1 days"));
收到错误消息
Warning: strtotime(): It is not safe to rely on the system's timezone settings.
You are required to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning,
you most likely misspelled the timezone identifier.
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
如何使用 date_default_timezone_set()
函数并在所选日期中添加一天?
最佳答案
您可以通过添加一行来设置默认 utc 时区。由于系统时间可能会有所不同,您可以定义默认 utc 时间并创建或编辑日期
date_default_timezone_set('UTC');
$selected_date = date("Y-m-d", strtotime($date . "+1 days"));
关于php - 如何在 PHP 中使用 date_default_timezone_set() 函数和 +1 天的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26458744/
在 php 中,有没有办法在 .htaccess 或任何地方设置默认时区,只要我不必在每个 php 页面上都设置它。 如果我无法访问服务器,只能访问 PHP 文件。提前致谢 更新 我正在使用 apac
我将以下内容上传到美国的服务器: date_default_timezone_set('Asia/Calcutta'); echo date("Y-m-d H:i:s"); // time in In
你好吗,我在 Objective C 中有一个应用程序连接到一个出现一些错误的网站。这是第一个,有人可以帮助我们吗? 严格标准:date():依赖系统的时区设置是不安全的。您需要使用 date.tim
本文实例讲述了PHP date_default_timezone_set()设置时区操作。分享给大家供大家参考,具体如下: ?
在写php程序中有时会出现这样的警告: PHP Warning: date(): It is not safe to rely on the system's timezone settings.
我正在尝试使用 date_default_timezone_set()在 PHP 中,它接受 timezone identifier作为唯一参数。 如何仅使用通过 javascript 获得的时间偏移
date_default_timezone_set 不起作用。 我的代码: ini_set('display_errors', true); error_reporting(E_ALL); date_
长话短说 是否有 PHP5 识别的官方的、未弃用的时区为东部标准时间,而不是东部夏令时间? 短篇故事长:-P 哇,我不敢相信 PHP 竟然能通过设置时间来实现这样的集群。 我想使用 PHP5 的 da
正如标题所说,谁能解释一下为什么代码 ini_set( 'date.timezone', 'Europe/Athens' ); 有效但是 date_default_timezone_set( 'Eur
这似乎很奇怪,但我已经检查了所有内容,但仍然发生了一件奇怪的事情。 我无法更改我的 php 脚本的时区。 首先要做的是:我所做的是这样的: '; echo date('Y-m-d H:i:s'); ?
我在日志中发现此错误消息: PHP Notice: date_default_timezone_set(): Timezone ID 'utc' is invalid 如何解决?我在 Ubuntu 1
当我使用以下代码获取当前伦敦时间时,它给出了错误的时间。 测试时,当前伦敦时间为2011 年 6 月 1 日星期三下午 02:11:16,但我使用以下代码: date_default_timezone
PHP date_default_timezone_set() 可以从 GMT 偏移吗? 我有 mySQL 数据库: |timezoneid | gmt_offset | dst_offset
假设这段代码: '; echo gmdate('Y-m-d H:i:s O', $time).''; date_default_timezone_set('GMT'); $time = gmmktim
我使用 Codeigniters timezone_menu 给出 drop down box时区,我想知道我们应该如何通过 PHP date_default_timezone_set 使用这些时区?
php 的 date_default_timezone_set 是否调整为夏令时? 我有这段代码,想知道它是否总能得到正确的斯德哥尔摩时间? date_default_timezone_set('
我正在使用 http://phpexcel.codeplex.com在我的一个项目中,我遇到了一个问题。我想在单元格中写入 time() 值,我正在这样做: function writeTimeLin
date_default_timezone_set是否和php手册中定义的setlocale有同样的问题? locale information is maintained per process,
PHP 中 date_default_timezone_set 的作用范围是什么? 我的意思是如果我使用: function foo() { date_default_timezone_set('va
我已将时区设置为用户拥有的任何时区例如“America/New_York” date_default_timezone_set("America/New_York"); 然后我做出流畅的陈述 $dat
我是一名优秀的程序员,十分优秀!