开发者

date() or format_date() returning 1970?

I have a table with a date field, which is correctly populated.

When I do the following <?php print $mytable->date; ?> works fine; however, when I format it with date() or format_date() it开发者_运维百科 just returns 01/01/1970.

It's stored in an array before being put into an HTML table if that makes a difference.


You could use the following (if the format of $mytable->date fits strtotime()) and adopt first parameter to your needs:

<?php echo date('Y-m-d H:i:s', strtotime( $mytable->date )); ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜