Skip to main content

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.

java.util.date
-3 votes
0 answers
121 views

Java Date.toString() method produces two different results on different linux servers

We are getting org.postgresql.util.PSQLException: ERROR: invalid input syntax for type timestamp: "Wed Jun 26 23:27:35 TRT 2024" as an exception when our application tries to insert the ...
enanas's user avatar
  • 35
0 votes
1 answer
88 views

How to get Date in format MMM d, YYYY in java [duplicate]

I have a model class with 'Date' type field. //Model.java private Date createDate; I am trying to convert the database value of this createDate (which is YYYY-MM-DD format) to MMM d, YYYY, i.e., I ...
Suganya Rajendran's user avatar
-1 votes
1 answer
130 views

change java.util.Date format [duplicate]

I have a form passing dates to my backend in CET format: EEE MMM dd HH:mm:ss zzz yyyy now I want to convert this Date in another one with the format yyyy-MM-dd I don't want a String, I want transform ...
CoderJammer's user avatar
0 votes
0 answers
85 views

Different Groovy behavior for java.util.Date depending on whether the app is in a jar format or not

Ran into a puzzling situation... My Groovy (4.0.18) app is working smoothly (thanks to all the help I received!) So with IntelliJ's help I packaged it up into a jar file including all dependencies and ...
H. Dog's user avatar
  • 319
4 votes
2 answers
734 views

After migrating to Java 17, the date is displayed inaccurately

We've recently transitioned our application from Java 11 to Java 17. Subsequent to the deployment, we've noticed that certain records exhibit a discrepancy where dates are displaying with a one-day ...
Vivek Buddhadev's user avatar
-2 votes
1 answer
65 views

Enter the year and the number of weeks, return the corresponding Monday start time,

The code looks like this: LocalDate.of(year,1,1).with(WeekFields.of(Locale.ENGLISH).weekOfWeekBasedYear(),weekNumber).with(DayOfWeek.MONDAY) But when I count 49 weeks for this year, which is 2023, ...
Rab Zhu's user avatar
-4 votes
1 answer
100 views

not able to convert \ format java.util.Date to yyyy-mm-dd [duplicate]

I am trying to convert java.util.Date to java.util.Date but in different format Wed Oct 11 10:00:00 CDT 2023 --> 2023-10-11T10:00:00.000Z I show lot of post and also tried different solutions ...
Hitesh Kumar's user avatar
1 vote
1 answer
9k views

How do I convert a Java Date into an Instant for a given timezone? [closed]

I have an instance of the Date class and a time zone (e.g Europe/London). How do I convert this into an Instant? Is the below the correct way of doing this? LocalDateTime localDateTime = LocalDateTime....
kcon123's user avatar
  • 522
2 votes
2 answers
136 views

Why Date class does not support Internationalization?

I was going through the different ways that we can get Date and Time in java, while reading the documentation could not understand what the below quote mean. Unfortunately, the API for these ...
Leveling_up's user avatar
0 votes
1 answer
245 views

Converting LocalDate to java.util.Date [duplicate]

I'm trying to convert a java.time.LocalDate to java.util.Date, but I lose some days in the process. Here the code that shows the issue: public static void main(String[] args) { var localDate = ...
Abadellatif Abazine's user avatar
-1 votes
1 answer
125 views

TimeZone Date Conversion [Convert a Date object to a specified timeZone Date Object]

My approach : // initailize date object Date date = new Date(); // get time zone ZoneId zoneId = ZoneId.of("Asia/Dubai"); // create zonedDateTime object ZonedDateTime zdt = ZonedDateTime....
P Roopasree's user avatar
0 votes
1 answer
76 views

Java compute duration of Project and Tasks doesnt work

I am trying to compute the duration Of each Project and each Task appointed to the Project, unfortunately it always returns 0. computeDuration: Date minDate = projectTasks[0].gettaskFromDate();...
dannyph's user avatar
  • 27
1 vote
0 answers
70 views

Converting UTC time to Date object [duplicate]

I am trying to get the current UTC time and convert it into a Date object: OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); Date date = Date.from(now.toInstant()); The problem I ...
Joel's user avatar
  • 95
-1 votes
1 answer
515 views

Java Date mapping postgresql timestamp has no time, minutes and seconds

Java uses java.util.Date to save timeStamp type fields in postgresql database, and finds that there is no time, minutes and seconds, only year, month and day, which is very strange. I have tried to ...
wantToADaShen's user avatar
5 votes
1 answer
718 views

Why does the LocalDateTime conversion to java.util.Date is shifting for very old date?

I am having trouble with converting old dates from java.time.LocalDateTime to java.util.Date I tried a lot of variation and it still has the same shifted dates. I would assume that it is some weird ...
Nap's user avatar
  • 8,206

15 30 50 per page
1
2 3 4 5
22