如何将一个DateTime
转换为刻度线?
答案 0 :(得分:5)
使用Ticks
属性:
DateTime now = DateTime.Now;
long ticks = now.Ticks;
答案 1 :(得分:0)
static long ConvertDateTimeToTicks(DateTime datetime)
{
long ticks=datetime.Ticks;
return ticks;
}
static DateTime ConvertTicksToDateTime(long ticks)
{
DateTime datetime= new DateTime(ticks);
return datetime;
}