'날짜'에 해당되는 글 2건

날짜출력하기

Windows/c# 2011. 4. 1. 11:07

 string StrDate0, StrDate1, StrDate2, StrDayOfWeek, StrTime0, StrTime1, StrTime2;

            DateTime CurDate = DateTime.Now;

            StrDate0 = CurDate.Year.ToString("0000") +
                      CurDate.Month.ToString("00") +
                      CurDate.Day.ToString("00");

            StrDate1 = CurDate.ToShortDateString();
           StrDate2 = CurDate.ToLongDateString();

            StrDate0 = CurDate.Hour.ToString("00") +
                      CurDate.Minute.ToString("00") +
                      CurDate.Second.ToString("00");                      

            StrTime1 = CurDate.ToShortDateString();
           StrTime2 = CurDate.ToLongDateString();

            StrDayOfWeek = CurDate.DayOfWeek.ToString();

           DayOfWeek StrDayofWeek1 = CurDate.DayOfWeek;
           int StrDayofWeek2 = (int)CurDate.DayOfWeek;
Posted by 아로스

설명
한 식이 날짜로 변환될 수 있는지 여부를 나타내는 부울값을 반환합니다.
구문
IsDate(expression)
expression 인수는 날짜식 또는 날짜나 시간으로 인식될 수 있는 문자식입니다.

참고
IsDate 함수는 해당 식이 날짜이거나 유효한 날짜로 변환될 수 있는 경우 True를, 그렇지 않으면 False를 반환합니다. Microsoft Windows의 유효한 날짜 범위는 서기 100년 1월 1일에서 서기 9999년 12월 31일까지이지만, 운영 체제에 따라 그 범위가 달라집니다.
아래 예제에서 IsDate 함수는 식이 날짜로 변환될 수 있는 지 여부를 결정합니다.

Dim MyDate, YourDate, NoDate, MyCheck
MyDate = "1962년 10월 19일": YourDate = #10/19/62#: NoDate = "안녕하십니까?"
MyCheck = IsDate(MyDate)            ' True를 반환합니다.
MyCheck = IsDate(YourDate)          ' True를 반환합니다.
MyCheck = IsDate(NoDate)            ' False를 반환합니다.

Posted by 아로스
1

아로스

달력

05-05 13:43