Reputation: 615
I want my app to show the German version if the phone language is German, and the English version if the phone language is English.
There is this Predefined Formats
, but for the German version I don't like it.
How can I handle this?
private fun getTime(currentTime:Long): String{
val sdf = SimpleDateFormat("HH:mm")
val calendar = Calendar.getInstance()
calendar.timeInMillis = currentTime
val str = sdf.format(calendar.time)
return str
}
private fun getDate(currentTime:Long):String{
val myDate = Date()
val actualDate = myDate.time.plus(currentTime)
val myString = DateFormat.getDateInstance().format(actualDate)
return myString
}
Upvotes: 0
Views: 357
Reputation: 2107
Try using this constructor:
public SimpleDateFormat(String pattern, Locale locale)
Upvotes: 1