简单类型 / 日期和时间

using System;

var now = DateTime.Now;

var shortStyle = string.Format("{0:d} {0:t}", now);
//shortStyle is "6/22/15, 4:10 PM"

var customStyle = now.ToString("yyyy-MM-dd");
//customStyle is "2015-06-22"

Console.WriteLine(shortStyle);
Console.WriteLine(customStyle);