Questions tagged [java.util.date]

Through Java 7, the official class for representing a moment in time, using a thin wrapper around the number of milliseconds from epoch (1970-01-01). In Java 8, java.time.Instant and related classes were introduced as a replacement.

In the JDK through Java 7, the java.util.Date class is very widely used and contrary to what its name suggests, represents an instant rather than a "date" (i.e. a particular day). Date objects are mutable.

In Java 8, a new package java.time was introduced, which contains java.time.Instant to be used to represent an instant. This package should be preferred over using the old java.util.Date classes when writing new code.

323 questions
-3
votes
3 answers

How to convert a long to a Date with "dd/MM/yyyy" format

I have a variable of type Long. Long longDate = 20180201110400 It represents this: 2018/02/01 11:04:00 I want to convert the format and variable type like below: Format should be "dd/MM/yyyy" and type should be Date. How can I do that?
fuat
  • 1,484
  • 2
  • 19
  • 25
-3
votes
1 answer

Comparing only dates not working properly in Java

I'm having two dates for Java util package. Both of them are showing the same date. When I compare both, it shows as wrong. Here is my code and the log Date date1=new SimpleDateFormat("dd/MM/yy").parse(lastCall); logger.info(date1); -->Mon Sep 18…
Aliy
  • 197
  • 14
-3
votes
2 answers

How to perform a date conversion of following type

How to convert in java a string of format 2009/01 to a string of format 2009 January?
Jai
  • 369
  • 3
  • 16
-3
votes
2 answers

Java date timezone to GMT and convert to another format

I have a list of dates. Example: Tue Oct 21 17:05:37 EDT 2014 Tue Oct 22 18:05:37 IST 2014 Tue Oct 23 19:05:37 EST 2014 Since all dates are in dfferent timezone, i want to convert all dates to GMT zone and then convert all dates to…
Dinoop Nair
  • 2,663
  • 6
  • 31
  • 51
-4
votes
2 answers

The method getTime() is undefined for the type Object — what’s wrong?

I have created an application that generates a difference between two dates when u click on a button named "calculate difference", but I don't know whats wrong with this code. I tried different methods and without any result. If you can help me I…
-4
votes
3 answers

java.util.Date returning --> 2016-12-26 14:18:57.0 want to remove this .0

this is the code which returns Date but at the client side i am getting 2016-12-26 14:18:57.0 at the client side . what is the possible solution .. I am using node.js at the client side. But I think it has nothing to do with this problem . I WANT…
-4
votes
2 answers

Why I obtain this error when I try to build a Java.utile.Date object from a String?

I am working on a Java application and I have some problem trying to create a Date object: So I have done: Calendar dataRendimentoLordoCertificatoCalendar = Calendar.getInstance(); dataRendimentoLordoCertificatoCalendar.set(annoCorrente - 1, 10,…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
-7
votes
1 answer

How new Java.util.Date() works while other classes return just reference?

I am curious as to why new Java.util.Date() returns Date object but not address(reference) to itself on heap: System.out.println(new Date()); //Should print address(reference) of object on heap? like every other class I've been learning about for…
1 2 3
21
22