Java Date UTC Method

The UTC method of Java Date class determines the date and time. These are determined by arguments which are interpreted as a year, month, day of the month, an hour of the day.

This method is deprecated as of JDK version 1.1 it is replaced by Calendar.set(year + 1900, month, date, hrs, min, sec) or GregorianCalendar(year + 1900, month, date, hrs, min, sec), using a UTC TimeZone, followed by Calendar.getTime().getTime().

Syntax:

Parameters

year - the year minus 1900

month - the month between 0-11

date - the day of the month between 1-31

hrs - the hours between 0-23

min - the minutes between 0-59

sec - the seconds between 0-59

Return

The UTC method returns the total number of milliseconds since January 1, 1970, 00:00:00 GMT for the date and time as given by the arguments.

Example

Test it Now

Output:

Current date to string : Tue Oct 02 18:39:01 IST 2018

Next TopicJava Util Date




Latest Courses