如何在文章发布时添加日期和时间。 [英] how to date and time added when a article post.

查看:146
本文介绍了如何在文章发布时添加日期和时间。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在发布文章时显示日期和时间。



例如,当我在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())。你完成了。



欲了解更多,请查看这些。

http://i.stack.imgur.com/BuuTd.jpg [ ^ ]



http://stackoverflow.com/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.
http://i.stack.imgur.com/BuuTd.jpg[^]

http://stackoverflow.com/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


这篇关于如何在文章发布时添加日期和时间。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆