DateTime.Millisecond Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the milliseconds component of the date represented by this instance.
Assembly: mscorlib (in mscorlib.dll)
You can display the string representation of the Millisecond property by using the "fff" format specifier. For example, the following code displays a string that contains the number of milliseconds in a date and time to the console:
You can also display the millisecond component together with the other components of a date and time value by using the "o" standard format specifier. For example:
However, the "o" format specifier is intended less for displaying than for round-tripping or storing a DateTime value. You can also display milliseconds together with other date and time components by using a custom format string:
Version Notes
Windows Phone
System.DateTime.Now.Millisecond.ToString always returns zero on the Windows Phone Emulator.The following example demonstrates the Millisecond property.
Dim moment As New System.DateTime(1999, 1, 13, 3, 57, 32, 11) ' Year gets 1999. Dim year As Integer = moment.Year ' Month gets 1 (January). Dim month As Integer = moment.Month ' Day gets 13. Dim day As Integer = moment.Day ' Hour gets 3. Dim hour As Integer = moment.Hour ' Minute gets 57. Dim minute As Integer = moment.Minute ' Second gets 32. Dim second As Integer = moment.Second ' Millisecond gets 11. Dim millisecond As Integer = moment.Millisecond