I'm trying to parse a string into a timestamp using java.time.format. I am expected it to be in this format "dd/MM/yyyy HH:mm:ss". Here is my code.
val timeString = "Mon Sep 20 15:57:56 BST 2021"
val formatFinal = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")
val startTs = formatFinal.parse(timeString)
However i'm getting this error and I'm not sure why. I'm new to scala/java so may have missed something obvious.
Text 'Mon Sep 20 15:57:56 BST 2021' could not be parsed at index 0
val formatFinal = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss z yyyy")instead?