Convert Date String into Epoch in Java [duplicate]
问题 This question already has answers here : Convert a date format in epoch (5 answers) Closed 3 years ago . Is there a way to convert a given Date String into Milliseconds ( Epoch Long format) in java? Example : I want to convert public static final String date = "04/28/2016"; into milliseconds (epoch). 回答1: The getTime() method of the Date class returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. 回答2: You can simply parse it to java.util.Date