Custom DateTime format MM/dd/yyy hh:mm:ss.fff in CSharp

Description

The following code shows how to custom DateTime format MM/dd/yyy hh:mm:ss.fff.

Example


/*from  w  w w  . ja va  2s.co m*/

using System;
public class MainClass{
  public static void Main(String[] argv){  
    DateTime date3 = new DateTime(2008, 1, 1, 0, 30, 45, 125);
    Console.WriteLine("Date with milliseconds: {0:MM/dd/yyy hh:mm:ss.fff}", 
                      date3);

  }
}

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