• Post Reply Bookmark Topic Watch Topic
  • New Topic

Time difference between local host and GMT zone  RSS feed

 
Daniel Cote
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to write a simple algorythm to calculate the difference in time from my host local zone and GMT zone. I have this simple code:




and my output is this:




I don't understand the output for lines 4, 5 and 6.

I'm in a time zone GMT+2 now in summer (but in winter it will be GMT+1) so I expected in line 6 at least a diffenrence of 60*60*1000*2 millisecond, not 0 (?). I'd need know how to do this simple calculation but I don't know the right way to do it.

Thanks in advance.


 
Daniel Cote
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems I've found and easy way to get my time calculation:



output:



that's the value I'm looking for. I don't know why working with dates is so 'difficult' with Java.....
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel Cote wrote:I don't know why working with dates is so 'difficult' with Java.....


It isn't really that difficult. After all, you found the one-line answer to your question, didn't you? It's just that people seem to make it harder than it really is by starting with bad assumptions about how it works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!