在C#转换DD-MM-YYYY为MM / DD / YYYYY [英] Convert dd-mm-yyyy into mm/dd/yyyyy in C#
本文介绍了在C#转换DD-MM-YYYY为MM / DD / YYYYY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要约会DD-MM-YYYY转换成的日期和时间在C#中MM / DD / YYYY默认格式。
有字符串格式,它可以帮助我做的。
解决方案
(DateTime.ParseExact(输入DD-MM- YYYY,CultureInfo.InvarientCulture)的ToString(MM / DD / YYYY)
(假设不任何违约 - MM / DD / YYYY是的不的默认日期格式对于大多数人来说)
。
I want to convert date DD-MM-YYYY into default format of date time "MM/DD/YYYY" in C#.
is there string format which helps me to do.
解决方案
(DateTime.ParseExact(input, "dd-MM-yyyy", CultureInfo.InvarientCulture).ToString("MM/dd/yyyy")
(Not assuming any defaults – "mm/dd/yyyy" is not the default date format for most people.)
这篇关于在C#转换DD-MM-YYYY为MM / DD / YYYYY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文