■ CultureInfo 클래스 : yyyy-MM-dd HH:mm:ss 포맷 문자열 전역 설정하기

------------------------------------------------------------------------------------------------------------------------

using System;

using System.Globalization;

using System.Threading;

 

CultureInfo cultureInfo = CultureInfo.CurrentCulture.Clone() as CultureInfo;

 

cultureInfo.DateTimeFormat.LongDatePattern  = "yyyy-MM-dd";

cultureInfo.DateTimeFormat.LongTimePattern  = "HH:mm:ss";

cultureInfo.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";

cultureInfo.DateTimeFormat.ShortTimePattern = "HH:mm:ss";

 

Thread.CurrentThread.CurrentCulture   = cultureInfo;

Thread.CurrentThread.CurrentUICulture = cultureInfo;

 

Console.WriteLine(DateTime.Now.ToString());

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요