728x90
날짜형 -> 문자열
문자열 -> 날짜형
DateTime thisDate1 = new DateTime(2011, 6, 10);
Console.WriteLine("Today is " + thisDate1.ToString("MMMM dd, yyyy") + ".");
DateTimeOffset thisDate2 = new DateTimeOffset(2011, 6, 10, 15, 24, 16,
TimeSpan.Zero);
Console.WriteLine("The current date and time: {0:MM/dd/yy H:mm:ss zzz}",
thisDate2);
String dt = DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive
DateTime dt = DateTime.Parse("10/24/2022 4:01:35 PM", System.Globalization.CultureInfo.InvariantCulture);
CultureInfo ci = new CultureInfo("en-US");
var month = DateTime.Now.ToString("MMMM", ci);
728x90
반응형
'Software > C#' 카테고리의 다른 글
C# DevExpress - WinForm GridControl ComboBox (0) | 2025.01.27 |
---|---|
C# DevExpress - Winform GridControl Cell DataBar (0) | 2025.01.27 |
C# DevExpress - WinForm GridControl Header 90회전 (1) | 2025.01.20 |
C# 시작하기 - Namespace : System (0) | 2025.01.11 |
C# 시작하기 - DirectoryInfo (0) | 2025.01.11 |