My client is sitting in other Zone. On UI there is way to search by DateRange (start and end date).
Client sends start and end date in String form. eg -> startDate = "DD/MM/YYYY", endDate = "DD/MM/YYYY"
.
Server converts dates to searchStartDate = "DD/MM/YYYY 00:00:01"
and searchEndDate = "DD/MM/YYYY 23:59:59"
. But before searching in DB I need to add "zone time difference" in these searchStartDate
and searchEndDate
.
Different clients are sitting in different zones. How do we add/subtract the zone diff time using java 8 APIs?
eg - my server is running in UTC. and Client sitting in IST. I will subtract 5H:30M from both searchStartDate
and searchEndDate
before searching into DB.
What I have - LocalDateTime searchStartDate and searchEndDate
. What I want searchStartDate = searchStartDate.plus(<UtcIstTimeZoneDiff>)
.
Edit - Server knows the timeZone of every client.