시간을 알려주는 구조체이다. 사용법은 아래와 같고.
자세한 내용은 msdn의 구조체 항목에서 datetime 구조체를 참고하면 된다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DateTime dt = DateTime.Now;
string str;
str = string.Format("금일은 {0}년 {1}월 {2}일({3})이다", dt.Year, dt.Month, dt.Day, dt.DayOfWeek);
Console.WriteLine(str);
str = string.Format("현재 {0}시 {1}분 {2}초({3})이다", dt.Hour, dt.Minute, dt.Second, dt.Millisecond);
Console.WriteLine(str);
str = string.Format("dt.Date {0}", dt.Date);
Console.WriteLine(str);
str = string.Format("짧은 날짜 형식 {0}", dt.ToShortDateString());
Console.WriteLine(str);
}
}
}
'게임개발공부 > C#공부' 카테고리의 다른 글
c#과 c++의 데이터 차이 비교. API와도 비교. (0) | 2014.01.10 |
---|---|
C# 프로그래밍 <윈폼> <이벤트> <델리게이트> (0) | 2014.01.10 |
클래스와 구조체, 참조형과, 값형 (0) | 2013.12.30 |
변수가 사용됐다? 초기화의 순서는? (0) | 2013.12.30 |
인덱서 (0) | 2013.12.30 |