getMilliseconds() Method

This method returns the milliseconds part of a Date object.

Syntax

dateVar.getMilliseconds()

Returns

The millisecond of dateVar as a number from 0 to 999.

Usage

This method sets the millisecond of dateVar to millisecond. When given a date in millisecond form, this method returns the last three digits of the millisecond date; or, if negative, the result of the last three digits subtracted from 1000.

Example

This code fragment displays the time on the system clock. The number of milliseconds past the beginning of the second appears at the end of the message.