jodatime

java.lang.NoClassDefFoundError: org.joda.time.DateTime

强颜欢笑 提交于 2019-12-10 20:16:24
问题 Getting this error when starting the app on android 4.3 API 18. There are no compilation errors, and library is added in build.gradle compile 'joda-time:joda-time:2.9.2' On android api 23 works with no problems, but on this device the app crashes on start. Any idea why? ( already tried to clean, rebuild, etc) 回答1: Found the problem. I put in build.gradle multiDexEnabled true so I had to make my custom Application extend MultiDexApplication 来源: https://stackoverflow.com/questions/36698452/java

joda - parsing time zone of pubDate in RSS item

穿精又带淫゛_ 提交于 2019-12-10 19:34:53
问题 I'm parsing pubDate in RSS item using Joda. The date have to be in RFC-822 format: http://feed2.w3.org/docs/error/InvalidRFC2822Date.html The problem is that when there is a date like: Wed, 02 Oct 2002 13:00:00 GMT I have to use pattern: DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss ZZZ").withLocale(Locale.ENGLISH).withOffsetParsed(); But it can be also date like: Wed, 02 Oct 2002 15:00:00 +0200 . In this case ZZZ dosen't work, I have to use one Z: DateTimeFormat.forPattern("EEE, dd

Dividing a Joda Time Period into intervals of desired size?

五迷三道 提交于 2019-12-10 18:32:25
问题 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 time. eg. S = NOW, E = 10 sec after NOW, D = 3 sec. Therefore, P = 10 sec, C = 3, R = 1 sec. I want to store and display all the chunks C with their start times, end times and sizes. Finally, I want to store and display the remainder. How do I do this using Joda Time ? Does the API provide simple

Liberal date/time parsing in Joda-Time

会有一股神秘感。 提交于 2019-12-10 17:33:45
问题 Is it possible to create a single DateTimeParser which would parse: dates with time given dates without time (assuming time to be start of day) times without dates (assuming date to be today) or do I need to have three separate parsers, and try parsing strings with each one? In other words, is it possible to define optional fields in a parser? 回答1: org.joda.time.format.ISODateTimeFormat has a static method dateOptionalTimeParser() that uses the code below, based on the DateTimeFomatterBuilder

Inconsistent `w` symbol formatting from joda time to java.time

梦想的初衷 提交于 2019-12-10 17:29:02
问题 My team is looking to switch from Joda time to java.time , but we're seeing different behavior in formatting using the same pattern. The issue arises when we're using the week-of-week-year w symbol: final String dateString = "2016-01-04 00:00:00"; final String inputPattern = "yyyy-MM-dd HH:mm:ss"; // parse the input string using Joda final org.joda.time.format.DateTimeFormatter jodaInputFormatter = org.joda.time.format.DateTimeFormat.forPattern(inputPattern); final org.joda.time.DateTime

Register ObjectMapper in Spring 4.1.3 to serialize Joda DateTime

家住魔仙堡 提交于 2019-12-10 16:18:49
问题 I'm trying to configure ObjectMapper in my Web application to serialize/deserialise dates presented as Joda's DateTime in ISO 8601 format. I found useful library jackson-datatype-joda and it's module JodaModule so I've added dependency: <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> <version>2.4.4</version> </dependency> My Spring configuration: <bean id="objectMapper" class="org.springframework.http.converter.json

Why is Scala saying it can’t see members of org.joda.time.Period?

元气小坏坏 提交于 2019-12-10 15:53:49
问题 I’m writing a Scala script which uses Joda Time 2.0. When I try to run my script, I get errors like this: error: value weeks is not a member of object org.joda.time.Period case "w" => Some(Period.weeks(windowSpecNum)) I’m also getting the message for Period.minutes , Period.hours , and Period.days . This is really strange because I’m having no problem using other Joda Time classes, and because this class works fine in the Scala REPL: scala> Period.minutes(5) res0: org.joda.time.Period = PT5M

override first day of the week in joda?

感情迁移 提交于 2019-12-10 15:21:52
问题 Is it possible to override the firstday of Joda week to sunday ? since Joda uses Monday as its firstday of the week . Can any one please explain me if there is a way . I referred the below Topic in SOF Joda Time: First day of week? Thanks 回答1: No. First of all, overriding the first day of the week to sunday would require overwriting all other weekdays as well. But these final constants are defined in the class DateTimeConstants, which are impossible to overwrite. But you wouldn't want to

Serializing Joda DateTime with Jackson and Spring

旧巷老猫 提交于 2019-12-10 15:10:08
问题 I am having problems consistently serializing and deserializing a Joda DateTime from java to json and back again using Spring Boot and Jackson-databind 2.5.2. My pom.xml looks like this. <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.5.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> <version>2.5.2</version> </dependency> <dependency> <groupId

Jersey Joda Time ISO 8601 parameter in urlencoded form

限于喜欢 提交于 2019-12-10 14:56:34
问题 I am using Jersey: 1.17.1 and defined a REST service accepting "application/x-www-form-urlencoded". I would like to accept a parameter "b" in ISO-8601 format and let Jersey map this to a Joda DateTime. @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response createTask(@FormParam("a") String a, @FormParam("b") DateTime b) { ... but I am getting this exception SEVERE: The following errors and warnings have been detected with resource and/or