I am trying to figure out how the https://www.epochconverter.com/ website converts a String date to milliseconds and then replicate the same logic in Java/Kotlin code. But I am unable to come up with an equivalent Java/Kotlin code.
For example, for the date "1979/12/31 23:30:00" is converted to 315552600000 milliseconds by https://www.epochconverter.com/
but my below kotlin code outputs 315531000000 instead of 315552600000.
import java.text.SimpleDateFormat
import java.time.*
import java.time.format.DateTimeFormatter
import java.util.*
fun main(){
val startTime = "1979/12/31 23:30:00"
val dateFormat = SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
val startTimeInMillis = dateFormat.parse(startTime).time.toString()
println(startTimeInMillis)
}
Is there anything missing in above code that is causing different results ?