How to convert days to milliseconds in C#

1 Answer

0 votes
using System;
 
class Program
{
    static int daysToMilliseconds(int days) {
        return days * 24 * 60 * 60 * 1000;
    }
    static void Main() {
        Console.WriteLine(daysToMilliseconds(1)); 
        Console.WriteLine(daysToMilliseconds(2)); 
        Console.WriteLine(daysToMilliseconds(10)); 
    }
}
 
 
 
    
/*
run:
    
86400000
172800000
864000000
    
*/

 



answered Mar 3, 2022 by avibootz

Related questions

1 answer 108 views
108 views asked Mar 3, 2022 by avibootz
1 answer 128 views
1 answer 125 views
1 answer 141 views
1 answer 130 views
1 answer 130 views
...