Text Practice Mode
Milliseconds to seconds C#
created Jun 5th 2023, 08:10 by Haider Ali (IYI)
1
77 words
16 completed
0
Rating visible after 3 or more votes
00:00
using System;
class Program
{
static void Main()
{
long milliseconds = 123;
TimeSpan timeSpan = TimeSpan.FromMilliseconds(milliseconds);
double seconds = timeSpan.TotalSeconds;
double minutes = timeSpan.TotalMinutes;
double hours = timeSpan.TotalHours;
double days = timeSpan.TotalDays;
double months = timeSpan.TotalDays / 30.12;
double years = timeSpan.TotalDays / 365.25;
Console.WriteLine("Milliseconds: " + milliseconds);
Console.WriteLine("Seconds: " + seconds);
Console.WriteLine("Minutes: " + minutes);
Console.WriteLine("Hours: " + hours);
Console.WriteLine("Days: " + days);
Console.WriteLine("Months: " + months);
Console.WriteLine("Years: " + years);
Console.ReadLine();
}
}
class Program
{
static void Main()
{
long milliseconds = 123;
TimeSpan timeSpan = TimeSpan.FromMilliseconds(milliseconds);
double seconds = timeSpan.TotalSeconds;
double minutes = timeSpan.TotalMinutes;
double hours = timeSpan.TotalHours;
double days = timeSpan.TotalDays;
double months = timeSpan.TotalDays / 30.12;
double years = timeSpan.TotalDays / 365.25;
Console.WriteLine("Milliseconds: " + milliseconds);
Console.WriteLine("Seconds: " + seconds);
Console.WriteLine("Minutes: " + minutes);
Console.WriteLine("Hours: " + hours);
Console.WriteLine("Days: " + days);
Console.WriteLine("Months: " + months);
Console.WriteLine("Years: " + years);
Console.ReadLine();
}
}
saving score / loading statistics ...