date()给了我昨天的日期而不是今天 - 为什么? [英] date() gives me yesterday's date and not today's - why?
问题描述
$ result [$ i] - > record_entered包含由
MySQL设置的当前日期(输入为now())。
我在数据库中验证了日期是now(),在这种情况下,
将是2/9/2006。
但是,使用显示器查看页面时:
[PHP]<?= date(''n / j / Y'',strtotime($结果[0] - > record_entered))?> [/ PHP]
我得到2/8/2006相反,即使数据库后端表示
" 2/9/2006。发生了什么事?
Thanx
菲尔
i] - > record_entered包含由
MySQL(输入为now())设置的当前日期。
我在数据库中验证了日期是now(),在这种情况下,
将是2/9/2006。
但是,使用显示器查看页面时:
[PHP]<?= date(''n / j / Y'',strtotime(
result [0] - > record_entered))?> [/ PHP]
我得到2/8/2006相反,即使数据库后端表示
" 2/9/2006。发生了什么事?
Thanx
Phil
检查
$result[$i]->record_entered contains the current date as set up by
MySQL (entered as "now()").
I verified that in the database the date is "now()", which in this case
will be "2/9/2006".
However, when viewing the page using the display:
[PHP]<?= date(''n/j/Y'', strtotime($result[0]->record_entered)) ?>[/PHP]
I get "2/8/2006" instead, even though the database back-end says
"2/9/2006". What''s going on?
Thanx
Phil
i]->record_entered contains the current date as set up by
MySQL (entered as "now()").
I verified that in the database the date is "now()", which in this case
will be "2/9/2006".
However, when viewing the page using the display:
[PHP]<?= date(''n/j/Y'', strtotime(
result[0]->record_entered)) ?>[/PHP]
I get "2/8/2006" instead, even though the database back-end says
"2/9/2006". What''s going on?
Thanx
Phil
Check the
这篇关于date()给了我昨天的日期而不是今天 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!