当前时间+ 24小时

编程入门 行业动态 更新时间:2024-10-25 19:28:21
本文介绍了当前时间+ 24小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好 如何格式化当前+24小时的日期和时间,如下所示: 2010年5月24日,星期一21:23:04 GMT 谢谢

Hi guys How can I format the current+24 hour Date and Time to look like this: Mon, 24-May-2010 21:23:04 GMT Thanks

推荐答案

如果您给我们用什么语言,这会有所帮助.日期时间的to string方法采用格式字符串. www.codeproject/KB/cs/String2DateTime.aspx It would help if you old us what language. The to string method on the date time takes format strings. www.codeproject/KB/cs/String2DateTime.aspx

String.Format("{0:r}",DateTime.Now); (DateTime.Now).ToString("{0:r}"); String.Format("{0:r}", DateTime.Now); (DateTime.Now).ToString("{0:r}");

请参见此处 [ ^ ]中列出了可以使用的格式. 以下是一些选项: see here[^] for a list of formats that you can use. here are some options: DateTime.UtcNow.ToString("r") 'equals Mon, 24 May 2010 22:56:46 GMT 'If you want to add the hyphens try DateTime.UtcNow.ToString("ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'") 'equals Mon, 24-May-2010 22:56:46 GMT

您绝对想要UtcNow,因为这样会将它转换为协调的通用时间,即随意使用,当几分之一秒不重要时,格林威治标准时间(GMT)可以认为等同于UTC或UT1",来自en.wikipedia/wiki/Coordinated_Universal_Time [ ^ ]

you definitely want UtcNow though because that will convert it to coordinated universal time which "in casual use, when fractions of a second are not important, Greenwich Mean Time (GMT) can be considered equivalent to UTC or UT1" from en.wikipedia/wiki/Coordinated_Universal_Time[^]

更多推荐

当前时间+ 24小时

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

发布评论

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

>www.elefans.com

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