TL; dr
OffsetDateTime.parse( "2013-04-03T17:04:39.9430000+03:00" ).format( DateTimeFormatter.ofPattern( "dd.MM.uuuu HH:mm" ) )
ISO 8601
As others have noted, your format is not at all weird. This is actually a standard format. This format refers to a collection defined in the ISO 8601 format .
microseconds
These seven digits of the decimal fraction of a second, .9430000 , represent nanoseconds . Older date and time classes associated with the earliest versions of Java (java.util.Date/.Calendar/java.text.SimpleDateFormat) are only created for milliseconds (three decimal digits). Input values ββlike yours cannot be handled by old classes.
java.time
Fortunately, Java introduced new date and time classes that supplanted these old classes. New ones are in java.time . These new classes can handle nanoseconds (up to nine decimal digits), so there is no problem.
The java.time platform is built into Java 8 and later. Defined in JSR 310 . Most of the functionality was ported to Java 6 & 7 in the ThreeTen-Backport project and additionally adapted for Android in the ThreeTenABP project.
OffsetDateTime
OffsetDateTime represents a moment in the timeline with an offset from UTC . The input line 2013-04-03T17:04:39.9430000+03:00 has an offset of three hours ahead of UTC .
The java.time classes use ISO 8601 formats by default when parsing / generating strings. Therefore, there is no need to define a formatting pattern. We can parse this line directly.
OffsetDateTime odt = OffsetDateTime.parse( "2013-04-03T17:04:39.9430000+03:00" );
Line generation
To generate a string representation in the same style, call its toString method.
For a different format, define a formatting template.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "dd.MM.uuuu HH:mm" ); String output = odt.format( formatter );
Timezone
Please note that your entry has an offset from UTC, but not a true time zone. The time zone is the offset plus the rules for handling anomalies, such as daylight saving time (DST). For a real time zone, use ZoneId to get a ZonedDateTime . Look for many examples in Kara.
About java.time
The java.time framework is built into Java 8 and later. These classes supersede the problematic old obsolete date and time classes, such as java.util.Date , Calendar , & & SimpleDateFormat .
The Joda-Time project, which is now in maintenance mode, recommends switching to java.time classes.
To learn more, check out the Oracle Tutorial . And look in Kara for many examples and explanations. Specification: JSR 310 .
You can exchange java.time objects directly with your database. Use a JDBC driver compatible with JDBC 4.2 or later. No need for strings, no need for java.sql.* Classes.
Where to get java.time classes?
The ThreeTen-Extra project extends java.time with additional classes. This project is a testing ground for possible future additions to java.time. Here you can find some useful classes, such as Interval , YearWeek , YearQuarter and even more .