Child pages
  • Working with Dates (and timezones)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you want to search between 2 dates, like searching for everything of yesterday, but then you mean everything of what the users means of yesterday.  You need to make dates that for that user is yesterday.  Which could be dates like: "2019-28-10 00:00" and "2019-28-10 23:59", but those times are client times so in the current example in timezone +2. But the server is in +1 , and the server will do the searching if it does that with the 2 dates above as is then it would be searching for stuff that is in the "todayyesterday" of the server. So you need to convert or create them first to the times of the user:

...

If these 2 timestamps would be send to the client (Use as LocalDateTime as false), then the browser will "add" (formats it in its timezone) the time difference (1 hour) back on to it and it will then represent the exactly that day.

...