🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.util.date
Date Class (Java.Util) | Microsoft Learn
The class Date represents a specific instant in time, with millisecond precision. [Android.Runtime.Register("java/util/Date", DoNotGenerateAcw=true)] public class Date : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISe...
🌐
Javatpoint
javatpoint.com › java-util-date
java.util.Date class
The class represents the only date in Java. It inherits the java.util.Date class. The instance is widely used in the JDBC because it represents the date that can be stored in a database. Overview of Purpose: Represents a date without time in JDBC.
🌐
CodeGym
codegym.cc › java blog › java classes › java.util.date class
Java.util.Date Class
February 14, 2025 - What is java.util.Date Class? The java.util.Date class provides the date and time in java. This class provides constructors and methods to use the current date and time. To use this class in your code you...
🌐
TutorialsPoint
tutorialspoint.com › java › util › java_util_date.htm
Java Date Class
The Java Util Date class represents a specific instant in time, with millisecond precision.
🌐
Oracle
docs.oracle.com › javame › config › cldc › ref-impl › cldc1.0 › jsr030 › java › util › Date.html
java.util Class Date
java.lang.Object | +--java.util.Date · public class Date · extends Object · The class Date represents a specific instant in time, with millisecond precision. This Class has been subset for the MID Profile based on JDK 1.3. In the full API, the class Date had two additional functions.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › › › › java › util › Date.html
Date (Java Platform SE 8 )
October 20, 2025 - Java™ Platform Standard Ed. 8 ... The class Date represents a specific instant in time, with millisecond precision.
🌐
MIT
web.mit.edu › java_v1.0.2 › www › javadoc › java.util.Date.html
Class java.util.Date
All Packages Class Hierarchy This Package Previous Next Index · java.lang.Object | +----java.util.Date · public class Date · extends Object A wrapper for a date. This class lets you manipulate dates in a system independent way.
🌐
Tutorialspoint
tutorialspoint.com › java › java_date_time.htm
Java - Date and Time
Java provides the Date class available in java.util package, this class encapsulates the current date and time. The Date class supports two constructors as shown in the following table.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › class-use › Date.html
Uses of Class java.util.Date (Java Platform SE 8 )
October 20, 2025 - Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › java › util-date-class-methods-java-examples
util.date class methods in Java with Examples - GeeksforGeeks
September 8, 2021 - // Java Program explaining util.date ... // class having access to Date class methods public class NewClass { public static void main(String[] args) { Date mydate = new Date(); // Displaying the current date and time ...
🌐
Scaler
scaler.com › home › topics › java.util.date class
java. util.Date Class - Scaler Topics
December 13, 2022 - It is a class that extends java. util.Date class. It is used to represent SQL DATE, which keeps years, months, and days. No time data is kept. Here the date is stored as milliseconds since 1st January 1970 00:00:00 GMT.
Top answer
1 of 3
4

Just follow the javadoc, as it says:

public String toString()

Converts this Date object to a String of the form:

dow mon dd hh:mm:ss zzz yyyy

zzz is the time zone (and may reflect daylight saving time).

And when you dive into the source code, that this toString() implementation will at some point use TimeZone.getDefault() ( or to be precise: getDefaultRef()). In other words: the default implementation pulls in the "default" timezone of your JVM.

2 of 3
3

tl;dr

Current moment in UTC.

Instant.now()    // Capture current moment in UTC.
    .toString()  // Generate String in standard ISO 8601 format.

2018-01-23T01:23:45.677340Z

Current moment in India time zone.

ZonedDateTime.now( 
    ZoneId.of( "Asia/Kolkata" ) 
).toString()    // Generate string in format wisely extended from ISO 8601 standard, adding the time zone name in square brackets.

2018-01-23T06:53:45.677340+05:30[Asia/Kolkata]

Avoid legacy date-time classes

Why does java.util.Date object show date & time with respect to a timezone when in actuality, java.util.Date represents an instant on the time-line, not a "date"?

Because the java.util.Date and related classes (Calendar, SimpleDateFormat, and such) are poorly-designed. While a valiant effort at tackling the tricky subject of date-time handling, they fall short of the goal. They are riddled with poor design choices. You should avoid them, as they are now supplanted by the java.time classes, an enormous improvement.

Specifically to answer your question: The toString method of Date dynamically applies the JVM’s current default time zone while generating a String. So while the Date object itself represents a moment in UTC, the toString creates the false impression that it carries the displayed time zone.

Even worse, there is a time zone buried inside the Date object. That zone is used internally, yet is irrelevant to our discussion here. Confusing? Yes, yet another reason to avoid this class.

A java.util.Date instance has no concept of time-zone.

Not true. A Date represents a specific moment, a point on the timeline, with a resolution of milliseconds, in UTC. As you mention, it is defined as a count of milliseconds since the first moment of 1970 in UTC.

java.time

The java.time classes separate clearly the concepts of UTC, zoned, and unzoned values.

The java.time.Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction). This class replaces java.util.Date.

Instant instant = Instant.now() ;  // Capture current moment in UTC.

Apply a time zone (ZoneId object) to an Instant and you get a ZonedDateTime object. That class replaces the java.util.Calendar class.

ZoneId z = ZoneId.of( "Asia/Kolkata" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;  // Same simultaneous moment as `instant`, but different wall-clock time.

If a value has only an offset-from-UTC but not a full time zone, use the OffsetDateTime class.

For a date only, without time-of-day and without time zone, use the LocalDate class. This class replaces the java.sql.Date class. Ditto for LocalTime replacing java.sql.Time.

LocalDate xmasDate2018 = LocalDate.of( 2018 , Month.DECEMBER , 25 ) ;

If the zone or offset are unknown or indeterminate, such as "Christmas starts at stroke of midnight on December 25, 2018", use the LocalDateTime class. This class does not represent an actual moment, a specific point on the timeline. This class lacks any concept of time zone or offset. So it can only represent potential moments along a range of about 26-27 hours.

LocalDateTime xmasEverywhere2018 = LocalDateTime.of( xmasDate2018 , LocalTime.MIN ) ;

Or…

LocalDateTime xmasEverywhere2018 = LocalDateTime.of( 2018 , Month.DECEMBER , 25 , 0 , 0 , 0 , 0 ) ;

About java.time

The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.

The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.

To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.

With a JDBC driver complying with JDBC 4.2 or later, you may exchange java.time objects directly with your database. No need for strings or java.sql.* classes.

Where to obtain the java.time classes?

  • Java SE 8, Java SE 9, and later
    • Built-in.
    • Part of the standard Java API with a bundled implementation.
    • Java 9 adds some minor features and fixes.
  • Java SE 6 and Java SE 7
    • Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
  • Android
    • Later versions of Android bundle implementations of the java.time classes.
    • For earlier Android, the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › class-use › Date.html
Uses of Class java.util.Date (Java SE 17 & JDK 17)
January 20, 2026 - A thin wrapper around the java.util.Date class that allows the JDBC API to identify this as an SQL TIME value.
🌐
Baeldung
baeldung.com › home › java › java dates › java.util.date vs java.sql.date
java.util.Date vs java.sql.Date | Baeldung
January 8, 2024 - Class java.util.Date stores a date-time value as milliseconds since the epoch.
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › java › util › Date.html
Date (Java Platform SE 7 )
Java™ Platform Standard Ed. 7 ... The class Date represents a specific instant in time, with millisecond precision.
🌐
How to do in Java
howtodoinjava.com › home › java date time › guide to java.util.date class
Guide to java.util.Date Class - HowToDoInJava
February 17, 2022 - Learn to create new date, get current date, parse date to string or format Date object using java.util.Date class.
🌐
Classpath
developer.classpath.org › doc › java › util › Date-source.html
Source for java.util.Date (GNU Classpath 0.95 Documentation)
*/ 37: 38: package java.util; 39: ... java.text.DateFormat; 45: import java.text.SimpleDateFormat; 46: 47: /** 48: * <p> 49: * This class represents a specific time in milliseconds since the epoch....
🌐
Jenkov
jenkov.com › tutorials › java-date-time › java-util-date.html
Java's java.util.Date
Java's java.util.Date class was one of Java's first date classes. Today most of the methods in the class are deprecated in favor of the java.util.Calendar class.
🌐
Duke
www2.cs.duke.edu › csed › java › jdk1.4.2 › docs › api › java › util › Date.html
java.util.Date - cs.duke.edu
java.lang.Object java.util.Date ... · extends Object · implements Serializable, Cloneable, Comparable · The class Date represents a specific instant in time, with millisecond precision....
Top answer
1 of 14
296

The java.util.Date class isn't actually deprecated, just that constructor, along with a couple other constructors/methods are deprecated. It was deprecated because that sort of usage doesn't work well with internationalization. The Calendar class should be used instead:

Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 1988);
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DAY_OF_MONTH, 1);
Date dateRepresentation = cal.getTime();

Take a look at the date Javadoc:

http://download.oracle.com/javase/6/docs/api/java/util/Date.html

2 of 14
150

tl;dr

LocalDate.of( 1985 , 1 , 1 )  // Months 1-12 for January-December. 

…or…

LocalDate.of( 1985 , Month.JANUARY , 1 )

Details

The java.util.Date, java.util.Calendar, and java.text.SimpleDateFormat classes were rushed too quickly when Java first launched and evolved. The classes were not well designed or implemented. Improvements were attempted, thus the deprecations you’ve found. Unfortunately the attempts at improvement largely failed. You should avoid these classes altogether. They are supplanted in Java 8 by new classes.

Problems In Your Code

A java.util.Date has both a date and a time portion. You ignored the time portion in your code. So the Date class will take the beginning of the day as defined by your JVM’s default time zone and apply that time to the Date object. So the results of your code will vary depending on which machine it runs or which time zone is set. Probably not what you want.

If you want just the date, without the time portion, such as for a birth date, you may not want to use a Date object. You may want to store just a string of the date, in ISO 8601 format of YYYY-MM-DD. Or use a LocalDate object from Joda-Time (see below).

Joda-Time

First thing to learn in Java: Avoid the notoriously troublesome java.util.Date & java.util.Calendar classes bundled with Java.

As correctly noted in the answer by user3277382, use either Joda-Time or the new java.time.* package in Java 8.

Example Code in Joda-Time 2.3

DateTimeZone timeZoneNorway = DateTimeZone.forID( "Europe/Oslo" );
DateTime birthDateTime_InNorway = new DateTime( 1985, 1, 1, 3, 2, 1, timeZoneNorway );

DateTimeZone timeZoneNewYork = DateTimeZone.forID( "America/New_York" );
DateTime birthDateTime_InNewYork = birthDateTime_InNorway.toDateTime( timeZoneNewYork ); 

DateTime birthDateTime_UtcGmt = birthDateTime_InNorway.toDateTime( DateTimeZone.UTC );

LocalDate birthDate = new LocalDate( 1985, 1, 1 );

Dump to console…

System.out.println( "birthDateTime_InNorway: " + birthDateTime_InNorway );
System.out.println( "birthDateTime_InNewYork: " + birthDateTime_InNewYork );
System.out.println( "birthDateTime_UtcGmt: " + birthDateTime_UtcGmt );
System.out.println( "birthDate: " + birthDate );

When run…

birthDateTime_InNorway: 1985-01-01T03:02:01.000+01:00
birthDateTime_InNewYork: 1984-12-31T21:02:01.000-05:00
birthDateTime_UtcGmt: 1985-01-01T02:02:01.000Z
birthDate: 1985-01-01

java.time

In this case the code for java.time is nearly identical to that of Joda-Time.

We get a time zone (ZoneId), and construct a date-time object assigned to that time zone (ZonedDateTime). Then using the Immutable Objects pattern, we create new date-times based on the old object’s same instant (count of nanoseconds since epoch) but assigned other time zone. Lastly we get a LocalDate which has no time-of-day nor time zone though notice the time zone applies when determining that date (a new day dawns earlier in Oslo than in New York for example).

ZoneId zoneId_Norway = ZoneId.of( "Europe/Oslo" );
ZonedDateTime zdt_Norway = ZonedDateTime.of( 1985 , 1 , 1 , 3 , 2 , 1 , 0 , zoneId_Norway );

ZoneId zoneId_NewYork = ZonedId.of( "America/New_York" );
ZonedDateTime zdt_NewYork = zdt_Norway.withZoneSameInstant( zoneId_NewYork );

ZonedDateTime zdt_Utc = zdt_Norway.withZoneSameInstant( ZoneOffset.UTC );  // Or, next line is similar.
Instant instant = zdt_Norway.toInstant();  // Instant is always in UTC.

LocalDate localDate_Norway = zdt_Norway.toLocalDate();

About java.time

The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.

To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.

The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.

You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes. Hibernate 5 & JPA 2.2 support java.time.

Where to obtain the java.time classes?

  • Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
    • Java 9 brought some minor features and fixes.
  • Java SE 6 and Java SE 7
    • Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
  • Android
    • Later versions of Android (26+) bundle implementations of the java.time classes.
    • For earlier Android (<26), the latest Android tooling enables a process known as API desugaring to provide a subset of the java.time functionality not originally built into Android.
      • If the desugaring does not offer what you need, the ThreeTenABP project adapts ThreeTen-Backport (mentioned above) to Android. See How to use ThreeTenABP….