Reputation: 27899
I'm using the Joda-Time API to deal with date-time in my web application. I have a bit of confusion about using/specifying a specific zone in date-time comparison.
I have two textboxes - one for discount start date and the other for discount end date. A user is able to choose a date from a jQuery date-time picker.
These two dates need to be compared based on some criteria like,
and some others.
The question is not about how to make these comparisons. It is about a zone. In this scenario, is it necessary to specify a zone.
More specifically, is it necessary to use DateTimeZone
/DateTime
or LocalDateTime
is sufficient to make such comparison, regarding the Joda API?
Upvotes: 2
Views: 185
Reputation: 531
As per my personal exprience, when you are playing with date and time stuff; you must have to use timezone along with this. This will keep you accurate in date and time calculation especially in date and time with different zone. You can convert one date time with a time zone to another equivalent date time with different time zone. In Joda Time API, lot of method is there where you have to pass the timezone string or object of TimeZone for getting the correct date time.
Upvotes: 1