如何以长格式显示日期? [英] how to show date in long format ?

查看:120
本文介绍了如何以长格式显示日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从数据库中检索数据并将其显示在datalist中

问题是,我在此数据中的日期时间日期应该以长格式显示?

Hi, i'm trying to retrieve data from database and display it in datalist
the problem is, i have datetime date in this data that should be displayed in long format??

推荐答案

请参阅类型 System.DateTime 并查看所有名为 System.DateTime的方法。的ToString ;它会解释一切。请参阅:

http://msdn.microsoft.com/en -us / library / system.datetime.aspx [ ^ ];

另见: http: //msdn.microsoft.com/en-us/library/az4se3k1.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx [ ^ ]。



另请参阅每个 ToString <的代码示例/ code>方法和最后两个链接。这就是你所需要的。



-SA
Please see the type System.DateTime and review all the methods called System.DateTime.ToString; it will explain everything. Please see:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^];
see also: http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].

See also code samples per each of the ToString methods and two last links. This is all you need.

—SA


转换它....

DateTime.ParseExact(tempdatetime,dd / MM / yyyy hh:mm:ss tt,CultureInfo.InvariantCulture);

convert it....
DateTime.ParseExact (tempdatetime,"dd/MM/yyyy hh:mm:ss tt" ,CultureInfo.InvariantCulture );
or


这篇关于如何以长格式显示日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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