Questions tagged [android-jodatime]

58 questions
5
votes
2 answers

Why is JodaTime timezone shifting a date time?

When the string "2017-04-21T17:46:00Z" is passed into the first method the resulting formatted date string is "06:46 21 Apr 2017". Why is the hour moving by eleven hours? The input strings are being provided by an HTTP server application in JSON. I…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
4
votes
1 answer

joda-time library pattern "d" not translating locale language

I am using joda-time library for my Android project instead of Calendar. but unlike calendar I am facing a problem with locale language. According to system/device language all type of text is translating but the "d" pattern is not translating, it…
3
votes
3 answers

How to parse time (hour, minute) from a string?

Anybody know how to parse time (hour, minute and AM/PM) from a string that looks like "01:20" -> 1:20AM and "21:20" -> 9:20PM? Most solutions out there seem to assume or require a Date or Calendar object. My input time is actually coming from a…
kip2
  • 6,473
  • 4
  • 55
  • 72
3
votes
1 answer

Android converting date time parse error (even tried joda time)

I'm parsing a number of news feeds and each item's pubDate follows the same format: Sun, 11 Jun 2017 18:18:23 +0000 Unfortunately one feed does not: Sat, 10 Jun 2017 12:49:45 EST I have tried to parse the date with no luck using androids java…
JakeB
  • 2,043
  • 3
  • 12
  • 19
2
votes
2 answers

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.forPattern("EEE MMM dd HH:mm:ss Z…
2
votes
3 answers

Joda time gives parse Exception for BST timezone but not for GMT

I'm trying to compare current date with an input date, received in this format "EEE MMM dd HH:mm:ss zzz yyyy" This piece of code works when my input string is Wed Apr 01 09:00:00 GMT 2020 but doesn't work if its Wed Apr 01 09:00:00 BST 2020 . …
2
votes
4 answers

Formatting Joda-Time DateTime to String

I'm stuck with converting DateTime format to String, I just can't get any idea how to get only Hours Minutes and Seconds from this type correctly. When I tried my way I get something like 2020-01-17T20:19:00. But I need to get just 20:19:00. import…
2
votes
3 answers

String datetime convert to LocalDateTime object

I want to convert to this string to LocalDateTime object. How can I do that? "Thu Aug 29 17:46:11 GMT+05:30 2019" I already try something, but it didn't work. final String time = "Thu Aug 29 17:46:11 GMT+05:30 2019"; final String format =…
Nimantha
  • 165
  • 3
  • 11
2
votes
1 answer

Convert a local time to a specific country time with JodaTime

I am having problem trying to figure out how to convert a person's local time to a UK time with Joda. Say, 31-01-2015 12:00:01am Washington DC time(could be any country's time) to 31-01-2015 5:00:01am london time(London time should always be the…
aloy
  • 53
  • 6
2
votes
3 answers

How to calculate No of Years, Months and days between two dates using Joda-Time

I'm using below code to calculate No of Years, Months and days between two dates using Joda-Time public void getDateDiff(View view) { DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy").withLocale(Locale.US); DateTime…
Goku
  • 9,102
  • 8
  • 50
  • 81
2
votes
1 answer

java : How to add days to Hijri date?

Using Joda I write: public static String adjustHijri(String dateHijri, int plusDays) { // dateHijri formatted as yyyy-MM-dd, eg: 1440-02-30 int yearHijri = Integer.parseInt(dateHijri.substring(0, 4)); int monthHijri =…
geek
  • 346
  • 6
  • 14
2
votes
1 answer

Jodatime IllegalInstantException

I've tried almost everything about this snippet, and I still get IllegalInstentException. public int getDateDay() { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTime dt; try { dt =…
Péter Kovács
  • 184
  • 1
  • 1
  • 17
2
votes
1 answer

Wrong timezone offset on Android after JodaTime parsing

I try to parse date in ISO format by JodaTime library for android, and get wrong timezone offset. String dateString = "1990-05-03T20:00:00.000Z"; DateTimeFormatter inputFormatter =…
preceptron
  • 193
  • 4
  • 11
2
votes
3 answers

How to calculate next birthday using Joda time libaray

I have two dates in format like Date of birth suppose 1995/04/09 and current date 2016/07/24 so how can I get Months and Days remaining to next birthday public String getNextBirthdayMonths() { LocalDate dateOfBirth = new LocalDate(startYear,…
Shareque
  • 361
  • 4
  • 23
1
vote
1 answer

How can I get the list of days of each month in the "JODA" library?

I need to get a list of days each month in the JODA library. how can I do that?
Saeed Noshadi
  • 829
  • 12
  • 34
1
2 3 4