如何在文章发布时添加日期和时间。

编程入门 行业动态 更新时间:2024-10-27 15:21:42
本文介绍了如何在文章发布时添加日期和时间。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望在发布文章时显示日期和时间。 例如,当我在Facebook上发帖时,他们会以当前日期/时间发布。 与我想要显示的日期和时间相同。

I want to show date and time show when I publish a article. for example when I post in Facebook they are posting with current date/time. same to same I want to show date and time.

推荐答案

在表格中添加新列在哪里存储名为DateTime(datetime)的文章,并将默认值设置为(getdate())。你完成了。 欲了解更多,请查看这些。 i.stack.imgur/BuuTd.jpg [ ^ ] stackoverflow/questions/4888277/add-default-value-of-datetime-field-in-sql-server-to-a-timestamp?answertab=active#tab-top [ ^ ] Add a new column in your table where you are storing the articles named DateTime (datetime) and set the default value to (getdate()). And you are done. For more check these one. i.stack.imgur/BuuTd.jpg[^] stackoverflow/questions/4888277/add-default-value-of-datetime-field-in-sql-server-to-a-timestamp?answertab=active#tab-top[^]

由于你还没有分享你到目前为止做了什么,很难说出你的意思可以使用您当前的代码。 所以请按照这个, 您需要添加一个列名称 PostDate 在你的表中并输入 DateTime 。 现在使用你的代码,w如果在文件数据库中上传/插入您的文章详细信息,您可以使用 DateTime.Now 获取PostDate。 -KR As you haven't shared what have you done so far, it's hard to tell what you can with your current code. So follow this, You need to add one column name as PostDate in your table and type it as DateTime. Now using your code, while uploading/inserting your article details in the database, you can use DateTime.Now for the PostDate. -KR

更多推荐

如何在文章发布时添加日期和时间。

本文发布于:2023-07-23 19:22:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1199618.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   时间   如何在   文章

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!