Best way to access the hour portion of a time string? (Java)

27 Views Asked by At

Essentially I'm going to be reading in a time string from the user in the format "HH:MM:SS" in 24hr format. I want to be able to say if HH > 12, then assign a variable "PM" and if HH < 12, then assign a variable "AM".

Is splitting the string and then parsing the HH portion of that string the most efficient way to extract that segment for my purposes?

0

There are 0 best solutions below