Questions tagged [jodatime]
Joda-Time provides a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still providing a simple API.
2,917
questions
0
votes
1
answer
27
views
Joda.Time DateTimeFormat returns: java.lang.IllegalArgumentException: Invalid format is malformed
I am converting some date formats from "ddMMMyyyy" to "yyyy-MM-dd". I have written the code below:
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import ...
0
votes
0
answers
23
views
How to override @CreatedDate in Spring data JPA
I have two mongo collections, one is the Foo collection and another is the FooHistory collection.
The Foohistory collection is an exact copy of the Foo collection but it creates every time a new ...
3
votes
1
answer
85
views
Converting Joda DateTime to JavaTime
I am trying to update my existing elasticsearch springboot project and as the source code is fairly old it still uses joda time. Now I have to upgrade all the functions of Joda time to java time. Now ...
0
votes
1
answer
121
views
Tests pass in my timezone, but fail on the remote/onshore/offshore Jenkins server
When I am running my test cases locally it is running fine, but running in the Jenkins server it is failing. can someone help me with this?
TestCase Code:
@Test
public void testingError(){
List<...
0
votes
0
answers
16
views
Add logic to date deserialisation done by Joda for Jackson
I have timestamps that can be floats. Before being parsed by Joda to be converted into a DateTime object, I want to parse the string of the timestamp, to round it down to an integer, so that Joda can ...
1
vote
1
answer
56
views
Write org.joda.time.DateTime to DB as string instead of object?
Right now, the following object is being written to a JSONB column in a postges db:
{
"id": "custom_ 6ef7181d-6afd-4632-b867-523c9d690af4",
"name": "bla",
...
0
votes
0
answers
25
views
How can I compare a Postgres timestamp without timezone value to a Joda DateTime
I have a timestamp without timezone value in a Postgres DB that I need to interpret as a time in a particular timezone. Unfortunately, the table design is out of my control, so I have to resort to ...
1
vote
0
answers
28
views
Spring boot - Joda DateTime serialisation
In an Spring boot app, I have a DTO class with a org.joda.time.DateTime field type.
This DTO is the web response body in an endpoint and Spring boot is serialisating it to a timestamp.
I don't want ...
-1
votes
1
answer
38
views
How to convert joda DateTime with timezone to DateTime with same time in UTC?
I have such input date:
DateTime date = new DateTime("2022-10-30T00:00:00.000+11:00");
How can I convert it to UTC while keeping the same time:"2022-10-30 00:00:00.000"?
In other ...
1
vote
1
answer
101
views
Why JodaTime Library and JDK OffsetDateTime report Pacific/Norfolk time zone offsets as different? Which one is correct?
public static void main(String[] args) {
System.out.println("Norfolk Island times as per Joda Time");
IntStream.range(1, 13)
.forEach(month -> System.out.println(...
2
votes
2
answers
425
views
Date format issue in Android 12
Following is the code to parse date. I have used 'joda-time:joda-time:2.9.9' lib for formatter.
String date = "Sun Sep 04 17:29:52 +0000 2022";
DateTimeFormatter dateFormat = DateTimeFormat....
0
votes
1
answer
188
views
failure in serializing optional date type filed to avro regardless of null value or non-null value
We are using avro1.8.2 to serialize data with optional date type field to be published to topic.
record aRecord {
/** Variable: lastUpdate
* lastUpdate indicates the latest date and ...
-2
votes
1
answer
85
views
Converting from Joda to Java time
I need to convert joda time to Java time but having some issues
My joda time code :
p.s method is a long type (long argDateString)
DateTime istime = new DateTime(argDateString*1000);
DateTime ...
0
votes
0
answers
56
views
Force Joda-Time date parsing to follow strictly the standard ISO 8601 pattern of YYYY-MM-DD [duplicate]
I want to parse date string and convert to local date. For parsing date I am expecting string to be in format of "yyyy-MM-dd". I have used following code to parse date string.
I am using ...
1
vote
1
answer
78
views
How to convert a custom Date Time string to milliseconds using Joda Time?
How can I create an instance of java.util.Date out of a custom date time string?
This is what I tried so far:
Given I have the this custom date time string:
Fri Jul 29 12:56:35 UTC 2022
Using Joda-...
0
votes
1
answer
92
views
Joda Time on android causing IllegalArgumentException
Description: The following method is supposed to get the date of the last inventory count from Firestore, and execute proceedWithInventoryMode() if it's been at least 24 hours.
private void ...
0
votes
1
answer
47
views
How to implement a Joda DateTime and Duration with fraction milliseconds
I have a requirement to implement a DateTime and Duration object that keeps track of its value using a fractional value. For all intents and purposes, these types should be equivalent to the Joda's ...
0
votes
1
answer
32
views
Joda lib in production
Since Java 8 release, it is recommended to migrate to Java Date APIs. We still continue to support Android API level 23, is it advisable to continue using Joda in production?
-1
votes
3
answers
223
views
Issue in fetching Local time with Java 8 Time API with particular pattern of date
I am having difficulty in finding the current time in some pattern with JAVA 8 time api.
I am trying below code for this, my goal is to find time in this pattern only -> yyyy-MM-dd'T'HH:mm:ss.SSS'Z'...
0
votes
1
answer
92
views
Why is this input an invalid format for Joda-Time PeriodFormatter?
I am trying to convert strings like 1h 30m 5s or 5m or 38s or 1h 3s into an integer value representing total time in seconds. So for example, 1m 20s would result in an integer value of 80 for 80 ...
0
votes
1
answer
621
views
Build org.joda.time.DateTime with java.time.LocalDate and java.time.LocalTime or java.time.LocalDateTime
So basically I have a DatePicker and TimePicker which will respectively give me a LocalDate and LocalTime. Now I want to use these values to make a org.joda.time.DateTime variable.
I'm not sure how to ...
2
votes
1
answer
2k
views
Jackson serialization failing when upgrading from 2.10 (InvalidDefinitionException: Type id handling not implemented for type java.lang.Object)
I'm upgrading from Jackson 2.10 to 2.12, and suddenly this simple test (which was working fine before) is now failing:
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping(...
1
vote
0
answers
31
views
Get Full Months and the Remaining as Days in Joda Time
I have the following code snippet with which I'm trying to get the total months that are in between a certain date and the remaining as the number of days.
import com.github.nscala_time.time.Imports._
...
0
votes
0
answers
21
views
Remaining Days With Joda Time When Calculating Months
I have the following code snippet that calculates the months between two dates:
import com.github.nscala_time.time.Imports._
import org.joda.time.{DateTime, Days, Interval, Weeks, Months}
import scala....
0
votes
0
answers
32
views
Can not Deserializer jodatime for dubbo3.0.4, how to soleve it?
This is the exception in the dubbo customer side
com.alibaba.com.caucho.hessian.io.HessianFieldException: org.joda.time.base.BaseDateTime.iChronology: 'org.joda.time.Chronology' could not be ...
2
votes
1
answer
638
views
How do I convert a LocalDateTime to a JavaScript Date object with JS-Joda?
how do I convert a LocalDateTime Object from the @js-joda/core library to a standard JavaScript Date object?
0
votes
3
answers
355
views
List of "Year-Month" from Current Year month to Jan-2021 in Java
I have a business requirement to write a service which returns the list of Year months (01-2021,02-2021,....) starting from 01-2021 to the current year month (current : 02-2022).
Can anyone suggest me ...
1
vote
1
answer
2k
views
How to convert Instant to joda DateTime?
How to convert Instant(java.time.Instant) to joda DateTime (org.joda.time.DateTime)? Or rather, what's the best way to do this?
0
votes
1
answer
129
views
Joda DateTime disregard/remove milis in comparing for equality
Is there an easier way to remove the millis part of joda DateTime?
Example: 2022-02-08T07:13:00.010Z -> 2022-02-08T07:13:00.000Z
I want to compare two datetimes.. but disregard the millis since the ...
-1
votes
2
answers
149
views
How can i find Joda-Time Jar file on my Mac?
As far as i know, once you use a maven library in pom.xml , a jar file will be downloaded to your computer.
I have used Joda-Time in my pom.xml , but i cannot find the joda-time-2.10.13.jar on my Mac
0
votes
1
answer
330
views
Logstash: How to match the timezone ID 'CET' in a date filter pattern?
In Logstash, I want to convert a string into a timestamp using the date filter. The string looks follows:
Fri Nov 05 06:24:28.651 CET 2021
I've tried the following pattern to no avail:
date {
...
2
votes
1
answer
197
views
Is this a bug in joda time? Handling very old (year 0000) instant / negative epoch
It seems like DateTime does not initialize itself with correct date when we construct it from a java.util.Date with year 0001.
import java.time.LocalDateTime;
import java.util.TimeZone;
public class ...
0
votes
1
answer
153
views
Swagger: Converting Java LocalDateTime to Joda LocalDateTime
I converted Java LocalDatetime to Joda LocalDateTime all around my program. Now my Swagger request json is causing 400 response header errors.
How do I resolve for this in Swagger?
This was original ...
2
votes
3
answers
227
views
Joda-Time Library Specifying mili second precision
I am converting the date and time string to Joda DateTime object, using this snipped of the code -
String time = "124204";
String date = "05/09/25";
DateTimeFormatter formatter = ...
2
votes
1
answer
330
views
SimpleDateFormat vs DateFormat vs Joda-Time : Which one should be preferred with Kotlin?
Which one is the most efficient in handling and formatting dates, and also avoids unnecessary dependencies on third-party components?
0
votes
0
answers
90
views
org.joda.time.LocalDate showing one day Less on Redhat (Linux) java
I am reading date from Mysql and sending this to browser using java spring boot application.
The dates are coming correct on the Windows based deployment.
However when I deploy this on the Redhat ...
0
votes
2
answers
81
views
Ingest 2-digit year with druid?
I want to ingest dates of the format MM/dd/yy (e.g. 02/01/03 for Feb 1 2003). I can't figure out how to specify this using a joda time format string, which seems to be what druid requires.
In java ...
1
vote
1
answer
75
views
JodaDateTime To BigDecimal Fraction Calculation
I need to calculate the difference between two dates as a fraction which can be used for a subsequent BigDecimal comparison using compareTo(....).
The input dates are java.util.Date so i'm trying to ...
2
votes
1
answer
158
views
JodaTime (Java): Hijri to Gregorian conversion inaccurate?
I am currently implementing a calendar converter which, given a Hijri input date and time, outputs the corresponding Gregorian date and time using the JodaTime library. However, the corresponding ...
1
vote
1
answer
498
views
Java JodaTime: java.lang.NoClassDefFoundError: org/joda/time/Chronology
I am writing a basic Java program using JodaTime to convert a date from the Gregorian Calendar to the Islamic Hijri Calendar. However, when I run my code, I get the following error:
Error: Unable to ...
1
vote
0
answers
163
views
Graal Native image: Resource not found: "io/trino/jdbc/$internal/joda/time/tz/data/ZoneInfoMap" ClassLoader
I am packing an application which connects with trino server in graal native image. When I ran the built docker image, I got this error:
java.io.IOException: Resource not found: "io/trino/jdbc/$...
0
votes
0
answers
83
views
How to find from a list of Intervals, what is the maximum number of simultaneous Intervals at any time
I am using Java 11 with SpringBoot and making a request to Elasticsearch which returns a list containing several start and finish dates for operations happening during a single day. Which I can use ...
1
vote
3
answers
1k
views
Java Convert String and Long to DateTime
I would like to generate a DateTime variable from two different variables (get the date from myLongDateAndTime and time from myStringTime, how can I do that?
String myStringTime="12:30:10"; ...
2
votes
0
answers
41
views
JodaTime parser crashes on America/Bahia_Banderas timezone [duplicate]
implementation "joda-time:joda-time:2.10.6"
Sending a DateTimeFormat.forPattern("HH:mm").parseDateTime("00:00") call works with most timezones but the America/...
1
vote
2
answers
112
views
Days between to date of different timezone using Joda
I have a input date string in format "2021-07-15T05:00:00.527+05:30"
I want date difference from current time (current time is in UTC).
DateTime inputDateTime = new DateTime(input, ...
0
votes
2
answers
71
views
Date pattrern format of 2021-02-22T00:00:00 [closed]
could somebody tell which is this date format ?
2019-01-22T00:00:00
I througth it is
YYYY-MM-DDThh:mm:ss
But i am getting java.lang.IllegalArgumentException: Illegal pattern component: T
I am using ...
0
votes
2
answers
292
views
Improper date Conversion in Java from LocalDateTime to joda DateTime
I am taking input in the java.time.LocalDateTime format as I need hours/minutes.
input : 2020-04-19T01:03:50
To interact with oracle DB from jpaRepostory, I am using
import org.joda.time.DateTime;
...
0
votes
1
answer
147
views
Check if the Intervals of a list are overlaped with the Intervals of another list
I have two lists with Intervals ie
[2021-06-29T00:00:00.000+03:00/2021-06-30T23:59:00.000+03:00, 2021-07-01T00:00:00.000+03:00/2021-07-06T23:59:00.000+03:00]
[2021-06-25T00:00:00.000+03:00/2021-06-...
0
votes
3
answers
80
views
Strip off seconds from joda DateTime java
I have an org.joda.time.DateTime object, its timezone is "Asia/Shanghai" (i.e. +08:00), the date time value of it is "2021-06-22T22:30:25+08:00". I want to strip off seconds from ...
0
votes
0
answers
260
views
Android : Proguard build is failing for joda time
I am getting the following error when I build the app with proguard. This failure is new. I updated some of the libraries used in the app to latest (including the target and compile sdk version to 30)...