https://kotlinlang.org logo
#random
Title
# random
d

ddsoyka

09/07/2017, 3:26 PM
Given the input
Jan 1, 2000 12:00 PM
, and the formats
MMM d, y h:mm a
&
MMM d, y HH:mm
, my question is: why do both formats match the input using
SimpleDateFormat
?
stackoverflow 2
n

nkiesel

09/07/2017, 6:16 PM
Because the
SimpleDateFormat
parser ignores "extra stuff" at the end. Change "PM" to "AM" and you will get 2 different timestamps. BTW: you should really use
FastDateFormat
5 Views