如何将DateTime格式化为String [英] How to format DateTime to String

查看:93
本文介绍了如何将DateTime格式化为String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人
现在将DateTime设置为字符串,以便输出

将显示"dd MMM yyyy hh:mm"

24小时内的hh,(不使用AM/PM)


谢谢
hanf

Dear all
DateTime now to string so the output

will show "dd MMM yyyy hh:mm"

where hh in 24 hour ,(not to use AM/PM)


thank you
hanf

推荐答案

使用大写字母"H"进行格式化.
Use capital "H" for formatting.
System.DateTime d = System.DateTime.Now;
Debug.WriteLine(d.ToString("dd MMM yyyy HH:mm"));



马斯(Maas)



Maas


这篇关于如何将DateTime格式化为String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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