I want a Class that only stores the time and not the date or day. Is there a class for this in Joda-Time ? or do I have to use a Date time and convert only the time part into a string and then use that part ?
So the short answer to your question is: YES (deprecated).
Joda-Time provides a comprehensive formatting system. There are two layers: High level - pre-packaged constant formatters. Mid level - pattern-based, like SimpleDateFormat.
Joda-Time is an API created by joda.org which offers better classes and having efficient methods to handle date and time than classes from java. util package like Calendar, Gregorian Calendar, Date, etc. This API is included in Java 8.0 with the java.
There's the LocalTime
class for that purpose.
Read more about partials here. E.g.:
LocalTime time = new LocalTime(12, 20);
String formatted = time.toString("HH:mm");
LocalTime
- Immutable class representing a time without a date (no time zone)
Check out this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With