DateTime Kind

Create a DateTime that differs from another only in Kind with the static DateTime.SpecifyKind method


using System;
using System.Text;
class Sample
{
    public static void Main()
    {
        DateTime d = new DateTime(2000, 12, 12);  // Unspecified 
        DateTime utc = DateTime.SpecifyKind(d, DateTimeKind.Utc);
        Console.WriteLine(utc);  

    }
}

The output:


12/12/2000 12:00:00 AM
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.