Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Difference between today and yesterday in C#

The difference is represented with milliseconds also.

using System;

namespace forgetCode
{
    class program
    {
        public static void Main()
        {
            // Difference between today and yesterday.
            DateTime yesterday = DateTime.Now.Subtract(TimeSpan.FromDays(1));
            DateTime now = DateTime.Now;
            TimeSpan diff = now.Subtract(yesterday);
            Console.WriteLine(diff);          
            
        }
    }
}


Output:
1.00:00:00.0010001