Suppose that my server located in USA and I live in Russia. We know that they have different time zones.
My application getting text(String
) from server. An
The Calendar class can convert times between timezones, so long as you know what timezone the server and the client use. To avoid problems in the future if you ever move the server, its best to define what the time in the database should be. I prefer to use UTC for this as its standard, but you can use any timezone you wish, so long as its defined and in your documentation so you'll know in the future.
Here's a question that shows how to do it: Date and time conversion to some other Timezone in java