Note that there are some explanatory texts on larger screens.

plurals
  1. POJoda Time bug or my mistake? (Java Joda Time dates as strings parsing)
    primarykey
    data
    text
    <p>so I was having a problem parsing a date, using the JodaTime chronology <code>IslamicChronology</code> so wrote a small example to demonstrate my problem.</p> <p>Here's the code:</p> <pre><code>import org.joda.time.Chronology; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormat; import org.joda.time.chrono.IslamicChronology; import java.util.Date; /** * Test */ public class Test { public static void main(String[] args) { Date now = new Date(); String format = "dd MMM yyyy"; Chronology calendarSystem = IslamicChronology.getInstance(); DateTimeFormatter formatter = DateTimeFormat.forPattern(format).withChronology(calendarSystem); String nowAsString = formatter.print(now.getTime()); System.out.println("nowAsString = " + nowAsString); long parsedNowTs = formatter.parseMillis(nowAsString); String parsedNowTsAsString = formatter.print(parsedNowTs); } } </code></pre> <p>And the output:</p> <pre><code>nowAsString = 16 10 1430 Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "16 10 1430" is malformed at "10 1430" at org.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:634) at test.Test.main(Test.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ... </code></pre> <p>I'm thinking the problem is that the month name is numeric but am I right? Anyone got any suggestions? This cannot be recreated if the chronology is gregorian.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload