如何更改日期格式? [英] How to change Date format?
本文介绍了如何更改日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DateTime dob = DateTime.Parse(txtPatientDateOfBirth.Text.Trim());
dob dd / MM / yyyy格式。
i想要将dob的格式更改为MM / dd / yyy
解决方案
http://stackoverflow.com/questions/16017979/display-datetime-into -mm-dd-yyyy-hhmm-format-c-sharp [ ^ ]
字符串 convertedDate = DateTime.ParseExact(dob.ToString(), dd / MM / yyyy , null )。ToString( MM / dd / yyyy);
首先尝试查看 MSDN(自定义日期和时间格式字符串)一>
DateTime dob = DateTime.Parse(txtPatientDateOfBirth.Text.Trim());
dob is in dd/MM/yyyy format.
i want to change the Format of dob to MM/dd/yyy
解决方案
http://stackoverflow.com/questions/16017979/display-datetime-into-mm-dd-yyyy-hhmm-format-c-sharp[^]
String convertedDate = DateTime.ParseExact(dob.ToString(), "dd/MM/yyyy", null).ToString("MM/dd/yyyy");
Try to look first on MSDN (Custom Date and Time Format Strings)
这篇关于如何更改日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文