I want to display time like this
09/07/18, 23:15:00 IST
I use above timeformat but instance of show timezone like this IST
its show GMT+05:30
. I use below code to parse a date :-
fun parseDate(time: String?): String? {
if (time != null) {
val inputPattern = "yyyy-MM-dd'T'HH:mm:ss"
val outputPattern = "MM/dd/yy, HH:mm:ss zzz"
val inputFormat = SimpleDateFormat(inputPattern, Locale.getDefault())
val outputFormat = SimpleDateFormat(outputPattern, Locale.getDefault())
var date: Date? = null
var str: String? = null
try {
date = inputFormat.parse(time)
str = outputFormat.format(date)
} catch (e: ParseException) {
e.printStackTrace()
}
return str
}
return time
}
Can any one help me to getting out this problem.