1

Here is the problem. It is bit complicated to explain. I'll try my best.

I have an application which has and administration portal and a user portal. This application is pretty old and done in java ee using struts framework. The db id oracle MySQL.

It is a tendering system so the time is very important. In administration portal when creating tenders and comparing publish/start/closing dates Server time is used. And in user portal it uses the machine time.

This application is to be used by users in different time zones.

So I thought if using GMT time. But then i will have to change every thing fron creating tenders and saving in database and retrieving and converting and all.

So is there any standard mechanism to handle time in a situation like this. Please also suggest me some links to refer and if anyone can help me with that is a great thing.

Bhugy
  • 711
  • 2
  • 8
  • 23

1 Answers1

1

You're right in thinking to store the date in GMT format. You'll have to understand the context, specifically meaning time zone. So it's always preferable to bring them to your local time zone before comparison as in case with your administration portal.

Now, coming to user portal where you have different user time zone, its better to have the GMT date sent as is and you'll need a way to get the user time zone and format to appropriate time zone before displaying it to the user.

s7vr
  • 73,656
  • 11
  • 106
  • 127
  • Thanks for your answer @Shiv V ..But is there a way to get time from the internet other than the hosting server? – Bhugy Jun 01 '16 at 03:40
  • time from internet ? I didn't get your question. What time are you talking about ? – s7vr Jun 01 '16 at 07:59
  • 1
    @Bhugy maybe you are referring to a 3rd party "clock" / sync service such as this? http://currentmillis.com/time/minutes-since-unix-epoch.php But that one can only estimate to the minute. If you want more you could look at the NTP protocol: http://stackoverflow.com/questions/925191/java-ntp-client (NTP = Network Time Protocol) – Sandman Jun 03 '16 at 20:38