如何将刻度转换为分钟?

我有一个刻度值28000000000,应该是480分钟,但我怎么能确定呢?如何将刻度值转换为分钟?

156541 次浏览

there are 600 million ticks per minute. ticksperminute

You can do this way:

TimeSpan duration = new TimeSpan(tickCount)
double minutes = duration.TotalMinutes;
TimeSpan.FromTicks(28000000000).TotalMinutes;

A single tick represents one hundred nanoseconds or one ten-millionth of a second. FROM MSDN.

So 28 000 000 000 * 1/10 000 000 = 2 800 sec. 2 800 sec /60 = 46.6666min

Or you can do it programmaticly with TimeSpan:

    static void Main()
{
TimeSpan ts = TimeSpan.FromTicks(28000000000);
double minutesFromTs = ts.TotalMinutes;
Console.WriteLine(minutesFromTs);
Console.Read();
}

Both give me 46 min and not 480 min...

The clearest way in my view is to use TimeSpan.FromTicks and then convert that to minutes:

TimeSpan ts = TimeSpan.FromTicks(ticks);
double minutes = ts.TotalMinutes;

TimeSpan.FromTicks( 28000000000 ).TotalMinutes;

DateTime mydate = new Date(2012,3,2,5,2,0);
int minute = mydate/600000000;

will return minutes of from given date (mydate) to current time.hope this help.cheers