Converting a date string to a DateTime object using Joda Time library

I have a date as a string in the following format “04/02/2011 20:27:05”. I am using Joda-Time library and would like to convert it to DateTime object. I did: DateTime dt = new DateTime(“04/02/2011 20:27:05”) But I’m getting the following error : Invalid format: “04/02/2011 14:42:17” is malformed at “/02/2011 14:42:17” How to convert the … Read more

Differences between Java 8 Date Time API (java.time) and Joda-Time

I know there are questions relating to java.util.Date and Joda-Time. But after some digging, I couldn’t find a thread about the differences between the java.time API (new in Java 8, defined by JSR 310) and Joda-Time. I have heard that Java 8’s java.time API is much cleaner and can do much more than Joda-Time. But … Read more

Joda DateTime to Timestamp conversion

It is a common misconception that time (a measurable 4th dimension) is different over the world. Timestamp as a moment in time is unique. Date however is influenced how we “see” time but actually it is “time of day”. An example: two people look at the clock at the same moment. The timestamp is the same, … Read more