Add hours to a DateTime
using System;
public class Example
{
public static void Main()
{
DateTime dateValue = new DateTime(2009, 3, 1, 12, 0, 0);
Console.WriteLine(dateValue.AddHours(0.001));
Console.WriteLine(dateValue.AddHours(0.0));
Console.WriteLine(dateValue.AddHours(1.1));
Console.WriteLine(dateValue.AddHours(0.25));
Console.WriteLine(dateValue.AddHours(0.6667));
}
}
Related examples in the same category