Questions tagged [android-jodatime]
58 questions
1
vote
1 answer
Joda Time toDate() wrong result
I am using this code:
date - Date object from DatePicker, as string Thu Sep 10 00:00:00 GMT+03:00 2020
mDate = DateTime(date)
.withHourOfDay(0)
.withMinuteOfHour(0)
.withSecondOfMinute(0)
…

Pavel Poley
- 5,307
- 4
- 35
- 66
1
vote
2 answers
Joda time plusDays getting wrong date
I am using this code:
DateTime(date)//Thu Aug 06 00:00:00 GMT+03:00 2020
.plusDays(days) // 103
.toDate()
And the result is Fri Dec 18 23:00:00 GMT+02:00 2020 instead of Dec 19.
With some dates it work well, with…

Pavel Poley
- 5,307
- 4
- 35
- 66
1
vote
0 answers
Joda-time: How do you convert a local time to UTC and then convert to another local time using milliseconds only?
Much like LotR, TimeZone conversions in Java is quite a saga. My requirement is simple. The issue is around using milliseconds to create DateTime objects.
I need to be able to take a local time in milliseconds, then convert it to UTC in milliseconds…

angryITguy
- 9,332
- 8
- 54
- 82
1
vote
2 answers
How to use Joda DateTime date as id in Room, or how to get date in query?
I need to write an app that uses date as id, and I must be able to update just by comparing date
@Entity
data class DailyCount(@PrimaryKey
var date:DateTime,
var summ: Double = 0.0)
And here is the…

Nurseyit Tursunkulov
- 8,012
- 12
- 44
- 78
1
vote
1 answer
Android JodaTime dateTimeFormatter doesn't always return UTC time
My problem is that dateTimeFormatter doesn't always give the same outcome I expected. Sometimes it returns UTC and sometimes phone's timezone. The method below converts a timestamp to yyMMdd-HHmmss format.
static String convertTimestamp(double…

ucanyiit
- 172
- 1
- 11
1
vote
3 answers
How to get list of dates from some date?
I have two variables:
startDate - for example 29/04/2018
howManyDays - for example 30
I want to get list of 30 days from date 29/04/2018. Can you tell me how can I do it? I found only days beetwen two dates.
int days = Days.daysBetween(startDate,…

haruki.phoenyx
- 27
- 2
1
vote
1 answer
Joda Time bad formatting when using locales other than english
I'm using Joda Time 2.9.9 in Android. When the Locale is set to english, calls like datetime.monthOfYear().getAsText(locale) and datetime.monthOfYear().getAsShortText(locale) return strings formatted like February and Feb respectively.
But when the…

tatarusanu1
- 67
- 9
1
vote
1 answer
How to include start date in Joda Time daysBetween?
Upon testing JODA time to get number of days that has been selected, it is excluding the start day.
Date from = day1.getTime();
Date to = day2.getTime();
int daysBetween = Days.daysBetween(new DateTime(from), new…

Woppi
- 5,303
- 11
- 57
- 81
1
vote
1 answer
JodaTime not working
I an new to android and am having trouble working with jodatime. I am getting the same error as many people on here and I have tried all the suggestions but nothing is working for me. I am trying to display the variables a user selected from a date…

Almac3
- 63
- 7
1
vote
4 answers
Cannot parse date using JodaTime
I've been trying to parse a simple date using JodaTime since yesterday and so far I keep on failing.....
Here's a (random) date I'm trying to parse:
2017-Sept-14 (Even with S in upper case doesn't change anything...)
Here's my code
…

Claude Hangui
- 426
- 3
- 8
- 29
1
vote
0 answers
Android Joda Time crash on Android
I see from stack traces next crash:
java.lang.IllegalArgumentException: Invalid format: "2017-08-29T00:00:00-0700" is malformed at "T00:00:00-0700"
Here is the code that does the conversion (it is not exactly the code since it is JSON parsing):
…

Eugen Martynov
- 19,888
- 10
- 61
- 114
1
vote
1 answer
Saving Joda Date on Firebase
What is proper way to store Joda Date and Time in android. When I tried to save it on Firebase and got Fatal Exception.
Here is the Snippet of Class of the object I want to save which says:
"Serializing Arrays is not supported, please use Lists…

Jawad Hassan Soomro
- 512
- 5
- 24
1
vote
0 answers
DateFormat's behaviour in Java different from DateFormat in Android
My requirement is to format a time, based on a specific locale.
I have written a Java program to format current time based on some locales and, it gives the output as shown below:
import java.text.DateFormat;
import java.util.Date;
import…

Zax
- 2,870
- 7
- 52
- 76
1
vote
3 answers
How to format Joda Time to dd-mm-yyyy in android?
String DOB = new DateTime(Long.parseLong(dob) * 1000, DateTimeZone.UTC ).toString();
// Current
// YYYY-MM-DD
// DOB = "1994-05-10T00:00.000Z"
// Required
// DD-MM-YYYY
// DOB = "10-05-1994"
I want to remove the hh:mm:ss and format the…

Sadda Hussain
- 343
- 5
- 19
1
vote
1 answer
Trying to find time difference in Joda Time between 2 DateTime objects
I'm trying to find the difference between 2 times using Joda Time. I've tried using some of the examples on here and can not get a value to return. Here is what I've tried: Where time is in a format like 17:23 and the to and from variables are…

Wayne Johnson
- 214
- 3
- 18