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
Post a Comment