PHP:strtotime()总是返回01/01/1970 [英] PHP : strtotime() returns always 01/01/1970
问题描述
我试图用 strtotime
在欧洲格式(dd / mm / yyyy)
中显示日期,但是它总是返回01/01/1970。
这是我的codeline:
<$ c $ ('d / m / Y',strtotime($ row ['DMT_DATE_DOCUMENT']))。< / h6>< / p>;回声< p>
在我的数据库中,该字段是一个varchar,记录格式如 yyyy.mm。 dd
对于像 yyyy-mm-dd (varchar)这样的其他字段,我使用相同的代码行
感谢您的帮助。
格式 I am trying to display dates in the Here is my codeline : In my database, the field is a varchar and records are formated like yyyy.mm.dd I use the same codeline for another field that is formated like yyyy-mm-dd (varchar too) and it works fine. Thanks for your help. Since the format
这篇关于PHP:strtotime()总是返回01/01/1970的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! yyyy-mm-dd
的作品,尝试用 - $ c替换
。
$ $ p $ date('d / m / Y',strtotime(str_replace('。',' - ',' $行[ 'DMT_DATE_DOCUMENT'])));
European format (dd/mm/yyyy)
with strtotime
but it always returns 01/01/1970.echo "<p><h6>".date('d/m/Y', strtotime($row['DMT_DATE_DOCUMENT']))."</h6></p>";
yyyy-mm-dd
works, try to replace .
with -
:date('d/m/Y', strtotime(str_replace('.', '-', $row['DMT_DATE_DOCUMENT'])));