DateTime 구조체
시간을 알려주는 구조체이다. 사용법은 아래와 같고.
자세한 내용은 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);
}
}
}