Create DateTime from specified year, month, day, hour, minute, and second in CSharp

Description

The following code shows how to create DateTime from specified year, month, day, hour, minute, and second.

Example


/*from   www  .jav a 2  s  . c  om*/

using System;
public class MainClass{
  public static void Main(String[] argv){  
    DateTime date1 = new DateTime(2010, 8, 18, 16, 32, 0);
    System.Console.WriteLine(date1.ToString());
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var