DateTime변환 본문

[PL]/C# & WPF

DateTime변환

객과 함께. 2012. 5. 31. 18:04
String to DateTime
1.String MyString = "1999-09-01 21:34 PM"; // 지역 및 설정에 따라 틀려질 수 있음.
2.DateTime MyDateTime = DateTime.ParseExact(MyString, "yyyy-MM-dd HH:mm tt", null);

1. string strDate = "2012-06-02 오전 3:20:15"
2.DateTime str1 = DateTime.ParseExact(strDate , "G", null)
"G"는 웹서핑에서 DateTime.ParseExact()로 검색을 해보시면 DateTime에 관련된 많은 형식이 있습니다.


DateTime to String
1.DateTime MyDateTime = new DateTime(1999, 09, 01, 21, 34, 00);
2.String MyString = MyDateTime.ToString("yyyy-MM-dd HH:mm tt");

참고 사이트 :kimstar.pe.kr