Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
2 answers
258 views

I am working on a Java 8 application where I receive epoch millisecond timestamps that represent UTC time. I need to pass these timestamps as Date objects to a method that I do not control (from a ...
buggy's user avatar
  • 37
0 votes
0 answers
61 views

My table has a TIMESTAMP column. Per our convention all times in the db is supposed to be in 'UTC'. When I insert a java.util.Date it is converted using the JVM's default TimeZone. There seems to be ...
Thomas Kiesling's user avatar
1 vote
1 answer
189 views

I am upgrading a groovy app from JDK11 to JDK17. One error I had to debug was with the following code: public static def getDayFromDate (Date date) { return date[Calendar.DAY_OF_MONTH] } For those ...
Reed M's user avatar
  • 312
0 votes
0 answers
184 views

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
  • 357
-2 votes
1 answer
79 views

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
2 votes
1 answer
20k views

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
  • 532
0 votes
1 answer
834 views

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
0 votes
1 answer
77 views

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
  • 19
-1 votes
1 answer
1k views

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
0 votes
0 answers
27 views

I want to get the week number from the date picker that user select even if the date was past date; String dateofweek= dateselect.getText().toString(); SimpleDateFormat format = new SimpleDateFormat(&...
VANSH AMBAWAT's user avatar
1 vote
1 answer
770 views

I have a use case where I get timeZoneId in UTC +/- format as String. Based on that I need to set correct timeZone in Java. Does anyone know the correct way of doing it? For example: String timeZoneId ...
kandarp's user avatar
  • 1,121
-1 votes
1 answer
1k views

Does anyone know how to grab or create the cdate value from Date? I haven't been able to figure out how to do so and I don't know how to necessarily get it. In the Date class it is there as ...
KennyL123's user avatar
0 votes
0 answers
178 views

I have a table in PostgreSQL that stores dob as datatype timestamp without timezone example value '1997-12-03 07:00:00'. My entity class is as follows @Table(name = "customer") ...
sia's user avatar
  • 1
0 votes
1 answer
106 views

My requirement is to convert the string "2019-04-25 07:06:42.790" to Date Object with same format as "2019-04-25 07:06:42.790". I tried to do this, but it is always giving in ...
Vikas's user avatar
  • 21
1 vote
2 answers
3k views

I have a value of type java.util.Date which was obtained from a legacy third-party API. Is there a direct way of converting it to kotlinx.datetime.LocalDateTime? I know how to do it only in a ...
k314159's user avatar
  • 12.4k
0 votes
3 answers
2k views

I have a method wherein have to check whether a LocalDate falls in between two java.util.Date values. there are methods after and before in java.util.Date and there are methods isAfter and isBefore in ...
Scientist's user avatar
  • 1,474
3 votes
3 answers
3k views

I have a datetime type column in mysql db and file fetching column using jdbctemplate and type casting it to java.util.Date throws error. Here is my code : I have defined the following ...
Vinayak Nair's user avatar
-2 votes
2 answers
1k views

This code example uses 3 time zones (EST, PST, EET). For each Time Zone, a Date object is created and the toString() is run to print out the format being used. Then this same String value is passed to ...
Unhandled Exception's user avatar
0 votes
0 answers
713 views

I have an elastic search db deployed within an AWS VPC. It holds millions of records all with a timestamp added based on the unix datestamp (new Date().getTime()). I am trying to pull (1) record per ...
Adam Kramer's user avatar
-2 votes
1 answer
157 views

I have a String s = "2020-02-22"`; and I want to change it to Date so I can store it in my database which has has a column that does not accept anything but Date. I tried using the ...
sammy's user avatar
  • 3
1 vote
0 answers
76 views

try { SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-DD'T'HH:mm:ss+hh:mm"); Date dateTime = format .parse("2020-11-22T05:57:10+01:00"); System.out.println(...
Dnyaneshwar Jadhav's user avatar
-2 votes
2 answers
2k views

In my Java College Class, I have to create the class Customer. A customer has to have a first name, the last name, a birthday and an address. The problem I have is to fill the default constructor ...
Sye's user avatar
  • 1
0 votes
1 answer
162 views

I'm designing a simple covid 19 tracking system. The system creates Visits object that is stored in an ArrayList everytime a Customer(objects in ArrayList) visits a Shop(objects in ArrayList). The ...
mayfly orin's user avatar
0 votes
3 answers
148 views

I am searching for a method to get the last third of two dates. first example: Date 1 = 22:00 Date 2 = 01:00 (next day) calculateLastThird(); (output: 00:00) second example: Date 1 = 22:25 Date 2 = ...
Unknownscl's user avatar
0 votes
2 answers
2k views

I use this function to parse strings into a date format fun formatTimestampEDDMMMYYYY(date: String): String { return E_DD_MMM_YYYY.format(Date.parse(date)) } Whilst it works perfectly the gradle ...
AndroidDev123's user avatar

1
2 3 4 5
7