Fortmat datetime to string [英] Fortmat datetime to string
本文介绍了Fortmat datetime to string的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮帮我!我想将日期时间格式化为字符串格式为
2013-11-15或2013/11/15 ....
ex:结果:2013年11月15日
非常感谢!!!!!
解决方案
如果你把它保存为日期时间,你可以这样做(你的DateTime Var).ToString(dd-MMM-yyyy)
试试这个..
string str = Convert。 ToDateTime(2013-11-15)。ToString(dd-MMM-yyyy);
您是否尝试过搜索MSDN(或谷歌)?简单的c#日期/时间格式字符串会带你到这里: MSDN [ ^
please help me! i want to format a datetime into string as
2013-11-15 or 2013/11/15....
ex: result: "15-Nov-2013"
thank so much!!!!!
解决方案
If you are keeping it stored as a datetime, you can just do (Your DateTime Var).ToString("dd-MMM-yyyy")
Try this..
string str =Convert.ToDateTime("2013-11-15").ToString("dd-MMM-yyyy");
Did you try searching MSDN (or google) at all? Simple "c# date/time format string" would have brought you here: MSDN[^]
这篇关于Fortmat datetime to string的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文