doumao1887 2015-09-29 16:29
浏览 30

当我在网站上提交帖子时,如何显示日期(“我H:i”)?

I made a social website where people from my class can ask questions and then it shows what time they uploaded the post, but i got 2 problems, first it's all in english and my website is danish. and the other problem is that it's showing what time it is when i'm refreshing. i made a while $row like this:

while($row = mysqli_fetch_assoc($select_all_posts_query)) {
    $post_id = $row['post_id'];
    $post_title = $row['post_title'];
    $post_author = $row['post_author'];
    $post_date = date("l H:i")
    $post_image = $row['post_image'];
    $post_content = substr($row['post_content'],0,100);
    $post_tags = $row['post_tags'];
    $post_comment_count = $row['post_comment_count'];

And searched through the internet but without luck.. Can you guys help me out on this one?

  • 写回答

1条回答 默认 最新

  • dongzan7016 2015-09-29 16:35
    关注

    "first it's all in english and my website is danish"

    Check out this setlocale function http://php.net/manual/en/function.setlocale.php

    Regarding why it shows you the current date, the answer is: this returns the current date that the code beying evaluated

    date("l H:i")
    

    You need something like this:

    date("l H:i", $row["someTimestampYouSaveWhenPostAdded"])
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?