Last active
October 6, 2019 14:52
-
-
Save ebouchut/415ff16aa327735ab846 to your computer and use it in GitHub Desktop.
Format a Java Date as UTC String: yyyy-mm-dd HH:mm:ss'Z'
This file contains hidden or 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
publicString formatDateAsUTC(Date date) { | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTime(date); | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'"); | |
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); | |
return sdf.format(date); | |
} |
Hey @sckirk
Good catch.
I updated the gist.
Thank you.
Awesome, thanks so much Eric!
- Suzannah
On Oct 6, 2019, at 4:05 AM, Eric Bouchut <[email protected]> wrote:
Hey @sckirk
Good catch.
I updated the gist.
Thank you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ebouchut: are you able to merge in the fork that I created? There is a typo in this gist, my fork corrects it.
In case other people reference this useful code in the future, I wanted to update it for them. :)