jodatime Questions

14

Solved

I have my app hosted in a London Server. I am in Madrid, Spain. So the timezone is -2 hours. How can I obtain the current date / time with my time zone. Date curr_date = new Date(System.currentT...
Barnaul asked 20/8, 2009 at 10:50

3

A custom class called MyCustomClass has a property that it s joda LocalDateTime. I need to create a java.util.Comparator class to compare instances of MyCustomClass by their TimeStamp property, whi...
Matherne asked 8/9, 2015 at 1:17

4

Solved

I'm using this Github project to get exposed to the new modular features in Java 9. I would like to add dependencies to the project and be able to build a native image. However, when I try to add a...
Valorievalorization asked 3/11, 2017 at 19:30

3

Solved

I have case class with joda Datetime field: case DomainPositionData(domain: String, position: Int, change: Option[Int], date:DateTime) Trying to use macro to generate reader&writer: implici...
Heaviness asked 21/5, 2013 at 6:53

3

Solved

I want to convert the current time to the time in a specific timezone with Joda time. Is there a way to convert DateTime time = new DateTime() to a specific timezone, or perhaps to get the number ...
Mallory asked 24/7, 2012 at 11:31

2

Solved

I'm trying to simply add TimeZone information back into a LocalDate before performing some more calculations. The LocalDate came from using the ObjectLab LocalDateCalculator to add days to an exist...
Wolter asked 11/1, 2011 at 10:19

3

Solved

This snippet of code always parses the date into the current timezone, and not into the timezone in the string being parsed. final DateTimeFormatter df = DateTimeFormat .forPattern("EEE MMM dd H...
Aten asked 25/8, 2009 at 9:56

4

Solved

I know there are questions relating to java.util.Date and Joda-Time. But after some digging, I couldn't find a thread about the differences between the java.time API (new in Java 8, defined by JSR ...
Roping asked 8/7, 2014 at 12:28

8

Solved

I want the number of months between 2 java.util.Date's, without the days in month counted. So I just want the year and month in the comparison. Example: monthsBetween(new Date(2012,01,28), new Dat...
Kendrickkendricks asked 26/11, 2012 at 14:14

6

Solved

I need to calculate the time elapsed from one specific date till now and display it with the same format as StackOverflow questions, i.e.: 15s ago 2min ago 2hours ago 2days ago 25th Dec 08 Do yo...
Sivan asked 1/2, 2010 at 19:59

10

Solved

I have a string "11/15/2013 08:00:00", I want to format it to "11/15/2013", what is the correct DateTimeFormatter pattern? I've tried many and googled and still unable to find the correct pattern....
Josefinejoseito asked 2/12, 2013 at 14:53

6

Solved

Is there an elegant way to find the nearest day of the week for a given date using JodaTime? I initially thought setCopy() would be it, but this sets the day to the particular day in the same week....
Pansypant asked 30/11, 2011 at 5:26

3

Solved

I have the following joda date parser: ISODateTimeFormat.dateTimeParser().withOffsetParsed(). I'd like to refactor this to java.time api. But what is the exact equivalent to the parser above, esp...
Urano asked 13/7, 2016 at 10:21

6

Solved

I have spent hours trying to make this next piece of code work. import org.joda.time.{DateTime, Period} def dateRange(from: DateTime, to: DateTime, step: Period): Iterator[DateTime] =Iterator.it...
Noddy asked 17/7, 2013 at 3:47

5

Solved

I want to convert 21022019 to 2019-02-21, but some reason I am not able to convert. import org.joda.time.LocalDate; import org.joda.time.LocalDateTime; import org.joda.time.format.DateTimeFormat; ...
Polytypic asked 28/1, 2019 at 14:28

2

Solved

I'm using Spring Boot 1.5.6 with Jackson 2.8.8. When deserializing the answer of a REST call, Jackson fails with the following exception: JSON parse error: Can not construct instance of org.joda...
Eared asked 19/3, 2018 at 10:51

7

Solved

In plain Java, I have this code to get the last Sunday of the month. Calendar getNthOfMonth(int n, int day_of_week, int month, int year) { Calendar compareDate = Date(1, month, year); compareDat...
Janus asked 11/9, 2012 at 12:34

4

Solved

I have a "period" (P) of time that is represented by a start time (S) and an end time (E). I want to divide P into C chunks of size D. That is, P = C * D + R, where R is the remainder or leftover...
Harod asked 12/3, 2013 at 10:13

3

Solved

How to sort LocalDateTime objects? I tried the following: Comparator<Data> comparator = new Comparator<Data>() { @Override public int compare(final data o1, final data o2) { if (o1...
Ecstasy asked 17/9, 2015 at 8:8

2

Solved

I want to compare(finding remaining days and time between two days) using joda time. I am taking two DateTime object like this(one is starting and another is ending) DateTime endDate = new DateTim...
Accessible asked 6/11, 2011 at 9:23

6

Solved

How to round DateTime of Joda library to the nearest X minutes ? For example: X = 10 minutes Jun 27, 11:32 -> Jun 27, 11:30 Jun 27, 11:33 -> Jun 27, 11:30 Jun 27, 11:34 -> Jun 27, 11:30 Jun 27, 11...
Porte asked 27/6, 2012 at 8:34

3

I'm using Joda Time and need to display a date in the user's preferred format (note that before Android M, the format could be changed). A Joda DateTime can be formatted using DateTimeFormatter, w...
Monopoly asked 2/9, 2016 at 20:40

2

Solved

Time zone ids of Joda Time can simply be displayed with the following segment of code. Set<String> zoneIds = DateTimeZone.getAvailableIDs(); for(String zoneId:zoneIds) { System.out.println...
Inkerman asked 12/4, 2013 at 9:26

4

Solved

I got this error suddenly when compiled a signed Apk, and not sure how to fix it. Entry name 'org/joda/time/tz/data/Europe/Dublin' collided It's not pointing to any line, this is the Joda librar...
Neurologist asked 14/4, 2020 at 9:48

6

Solved

My API allows library client to pass Date: method(java.util.Date date) Working with Joda-Time, from this date I would like to extract the month and iterate over all days this month contains. No...
Heroic asked 14/2, 2010 at 14:56

© 2022 - 2025 — McMap. All rights reserved.