I found different topics on this subject but couldn't find a proper solution to my problem yet. How can I get the current UTC time, add for example 60 minutes to it, and the display it in this format: HH:mm:ss ? Is it possible? Thanks
I used this to get the UTC time, but I don't know how to add minutes to it and the change the format to display:
val df: DateFormat = DateFormat.getTimeInstance()
df.timeZone = TimeZone.getTimeZone("utc")
val utcTime: String = df.format(Date())
I also tried this function but it displays the current time from the device:
fun getDate(milliSeconds: Long, dateFormat: String?): String? {
val formatter = SimpleDateFormat(dateFormat)
val calendar = Calendar.getInstance()
calendar.timeInMillis = milliSeconds
return formatter.format(calendar.time)
}