java - Comparing if two Date instances refer to the same day -




i have 2 java instances of java.util.date , have find out if refer same day.

i can hard way, taking dates apart , compare days, making sure years match too.

since such common problem, expect there easier solution problem.

thanks!

instances of java.util.date refer instants in time. day fall on depends on time zone you're using. use java.util.calendar represent instant in particular time zone...

... or use joda time instead, much, better api. either way, you'll have know time zone you're interested in.

in joda time, once you've got relevant time zone, can convert both instants localdate objects , compare those. (that means can compare whether instant x in time zone on same day instant y in time zone b, should wish to...)





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -