날짜 출력 형식 변경
//16-Jun-2021
string result0 = DateTime.Now.ToString("dd-MMM-yyyy", new System.Globalization.CultureInfo("en-US"));
//hh = 12시간 기준
//HH = 24시간 시준
//2018-06-21 06:48:40.4868
string result1 = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.ffff");
//18-06-21 06:48:57.7224
string result2 = DateTime.Now.ToString("yy-MM-dd hh:mm:ss.ffff");
//18년06월21일 06시49분49.8483초
string result3 = DateTime.Now.ToString("yy년MM월dd일 hh시mm분ss.ffff초");
//93-02-25
System.DateTime dt = new System.DateTime(1993, 02, 25);
System.Windows.MessageBox.Show(dt.ToString("yy-MM-dd"));
시간측정
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
//측정시작
watch.Start();
//Run
Thread.Sleep(new System.Random().Next(1000, 10000));
//측정종료
watch.Stop();
//출력
MessageBox.Show(watch.ElapsedMilliseconds.ToString());