12 hours to 24 hours java

Solutions on MaxInterview for 12 hours to 24 hours java by the best coders in the world

showing results for - "12 hours to 24 hours java"
Yohann
21 Feb 2016
1String result =                                       // Text representing the value of our date-time object.
2    LocalTime.parse(                                  // Class representing a time-of-day value without a date and without a time zone.
3        "03:30 PM" ,                                  // Your `String` input text.
4        DateTimeFormatter.ofPattern(                  // Define a formatting pattern to match your input text.
5            "hh:mm a" ,
6            Locale.US                                 // `Locale` determines the human language and cultural norms used in localization. Needed here to translate the `AM` & `PM` value.
7        )                                             // Returns a `DateTimeFormatter` object.
8    )                                                 // Return a `LocalTime` object.
9    .format( DateTimeFormatter.ofPattern("HH:mm") )   // Generate text in a specific format. Returns a `String` object.
10;
11