I have a input date string in format "2021-07-15T05:00:00.527+05:30" I want date difference from current time (current time is in UTC).
DateTime inputDateTime = new DateTime(input, DateTimeZone.UTC);
DateTime now = new DateTime(DateTimeZone.UTC);
Days.daysBetween(now, inputDateTime).getDays();
If i convert the input date to UTC, This is yielding the wrong result. Is there any way to get the offset from input date and add it to current UTC date and then compare the Date?
EDIT:
Sorry for phrasing the question wrong. I am trying to find out is it Today or is it PreviousDay or isT it Tomorrow for the given input date which as offset with respect to utc timezone.
In server when time is 2021-07-14T23:00:00.527Z, for above input date, it should be taken as Today (i.e. 0). If in server time is 2021-07-14T13:00:00.527Z, for same input dat, it should be Tomorrow (i.e. 1).
Edit2:
I did try out converting both to localDate,
Days.daysBetween(now.toLocalDate(), inputDateTime.toLocalDate()).getDays()
but when UTC time is in previous date 2021-07-14T23:00:00.527Z, and the given date 2021-07-15T05:00:00.527+05:30, yields 1 but i am expecting it to be 0
`