Get the millisecond component of the time represented by the current DateTimeOffset object in CSharp

Description

The following code shows how to get the millisecond component of the time represented by the current DateTimeOffset object.

Example


using System;/*  w w  w.ja va  2  s . com*/

public class MainClass{
  public static void Main(String[] argv){  
    DateTimeOffset date1 = new DateTimeOffset(2014, 3, 5, 5, 45, 35, 649, 
                                    new TimeSpan(-7, 0, 0));
    Console.WriteLine("Milliseconds value of {0} is {1}.", 
                      date1.ToString("MM/dd/yyyy hh:mm:ss.fff"), 
                      date1.Millisecond);
    

  }
}

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