A
A
Alexander Ivanov2014-11-05 16:16:11
Java
Alexander Ivanov, 2014-11-05 16:16:11

How to work with dates in a client-server application?

A fairly standard development dilemma. There is one server and a bunch of clients that can save the date to the nearest second.
What options can be used to ensure that the date is transmitted between the server and the client with the correct time zone offset?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anyd3v, 2014-11-05
@anyd3v

Store everything in UTC+0 and translate on the client.

V
Vladimir Smirnov, 2014-11-07
@bobzer

Or maybe you don't need to do anything at all? The standard Java date types (java.util.Date/Calendar) have built-in time zone handling and even take daylight savings into account. It is enough to specify (TimeZone.setDefault) the correct time zone in the client and server JVM at runtime (usually it is set automatically), Java will do the rest. Are you sure you're not trying to solve a problem that doesn't exist?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question