Skip to content

Instantly share code, notes, and snippets.

@nadar71
Created October 21, 2020 09:46
Show Gist options
  • Save nadar71/23e3699705182e56ed40e50838f489cd to your computer and use it in GitHub Desktop.
Save nadar71/23e3699705182e56ed40e50838f489cd to your computer and use it in GitHub Desktop.
Return the local time midnight for the provided normalized UTC date.
// Return the local time midnight for the provided normalized UTC date.
fun getLocalMidnightFromNormalizedUtcDate(normalizedUtcDate: Long): Long {
val timeZone = TimeZone.getDefault()
val gmtOffset = timeZone.getOffset(normalizedUtcDate).toLong()
return normalizedUtcDate - gmtOffset
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment