In android studio kotlin or firebase how do I get the utc time and date that will be same on everyone's phone.
This is the code for getting utc time:
fun getUtcTimeAndDate(): String {
val df = SimpleDateFormat("MMM dd, h:mm a")
df.timeZone = TimeZone.getTimeZone("UTC")
return df.format(Date())
}
It gets the utc time from your phone but some phones have slightly different utc times.
I want to get the utc time from somewhere that on everyone's phone will be the same.