Skip to content

Instantly share code, notes, and snippets.

@gonaumov
Created January 29, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonaumov/cc60cc8fafc74da937f8291a6efeda70 to your computer and use it in GitHub Desktop.
Save gonaumov/cc60cc8fafc74da937f8291a6efeda70 to your computer and use it in GitHub Desktop.
// here never.created is Data
// formatter is SimpleDateFormat("y-M-d H:m:s")
// with timeZone = TimeZone.getTimeZone("UTC")
// The problem is that this comparison
// working properly on UTC+0
// When I set timeZone = TimeZone.getDefault()
// it starts to work on every other timezone
// instead UTC. The question is how to fix
// that in shortest way? Maybe to calculate
// current timezone offset and just to
// add it to never.created.time? I tried that
// with no luck. :(
assertThat(never.created.time).
isEqualTo(formatter.parse("2019-08-23 15:50:00").time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment