Last active
May 29, 2019 20:16
-
-
Save leonardoxh/c8d2757cd3acc9874936f1d4bdb69153 to your computer and use it in GitHub Desktop.
Simple timezone calculations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date | |
import java.uti.TimeZone | |
/** Local date to UTC */ | |
val Date.utc: Date get() = Date(time + TimeZone.getDefault().rawOffset) | |
/** UTC date to local date */ | |
val Date.local: Date get() = Date(time - TimeZone.getDefault().rawOffset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment