C# DateTimeOffset Millisecond

Description

DateTimeOffset Millisecond gets the millisecond component of the time represented by the current DateTimeOffset object.

Syntax

DateTimeOffset.Millisecond has the following syntax.


public int Millisecond { get; }

Example

The following example displays the number of milliseconds of a DateTimeOffset object by using a custom format specifier and by directly accessing the Millisecond property.


using System;/* ww w  .j  a  v  a2 s .  c  om*/

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 »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version