You're trying to parse "E MMM dd HH:mm:ss Z yyyy"
formatted date string as "yyyy-MM-dd HH:mm"
formatted one, in this line:
val date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(dateStr)
No wonder it fails.
Maybe you took the wrong date format for second SimpleDateFormat
instance by mistake? Or maybe you're passing wrong parameter to parse()
?
edit
It looks like you actually wanted to call:
val date = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(dat)