I am developing an android application. What should I do to get the current time based on Turkish local time?
val now = Calendar.getInstance(TimeZone.getTimeZone("GMT+3"))
the result is:
2020-08-25T18:16:30
but this website result is different: https://www.timeanddate.com/worldclock/turkey/istanbul
2020-08-25T16:46:30
The output is printed using the following code snippet:
DebugHelper.info("one now => ${now.getDisplayMonthNameDayTime(FULL_PATTERN)}")
Extention Function:
const val FULL_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"
fun Calendar.getDisplayMonthNameDayTime(pattern: String = "dd MMM , HH:mm ") = SimpleDateFormat(
pattern,
Locale.getDefault()
).format(time).toUpperCase(Locale.getDefault())