This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ranch Office and the fly likes Sri Lanka Standard Time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "Sri Lanka Standard Time" Watch "Sri Lanka Standard Time" New topic
Author

Sri Lanka Standard Time

Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3023
    
  35

The home page of this forum says
All times above are in your local time zone & format.


But the forum doesn't show the correct time for me, as I'm from Sri Lanka. We are currently using GMT+05:30 Time Zone in our country, since year 2006. But it seems that JavaRanch is using GMT+06:00 Time Zone for Sri Lanka, as we did before 2006. You can make it confirmed here, and please feel kind to correct this as soon as possible.

Devaka


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Devaka,
We use JavaScript to figure out your time zone. Does your browser know Sri Lanka has changed time zones?



[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3023
    
  35

Jeanne,

Finally I discovered the problem. It seems that problem is not only for my country. Well, let me show you.

The JavaScript at userLocalTime.js uses the logic below:




The problem is with statement below:


The above statements supposes to change the hour of the 'date', due to the local time zone. If my local time zone is GMT+5:30, the variable userOffsetFromGmt contains floating point (double) number, i.e. -5.5. Therefore, the expression passes a floating point value for the date.setHours method.
But remember that the method date.setHours accepts a 'numerical' value for it's first paremeter. In that case, it takes the numerical value to the account, by removing the decimal points. Oh! 30 minutes gonna lost!

As a suggestion, please replace that statement as below:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
Thanks for tracking this down; we'll put that in. I think Venezuela has a half-hour timezone as well, so you're not alone :-)


Ping & DNS - my free Android networking tools app
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18546
    
  40

I think Venezuela has a half-hour timezone as well, so you're not alone :-)


Another is Newfoundland in Canada -- home of the really cute Newfie. I always set my watch to the local time, so I was fine with it. My wife always keeps her watch in our home timezone, so it really annoyed her, when we were there...

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3003
    
    9
Considering India Standard Time is also at GMT+5:30, it's surprising no one here has noticed or mentioned this issue before.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Mike Simmons wrote:Considering India Standard Time is also at GMT+5:30, it's surprising no one here has noticed or mentioned this issue before.


Eh, give or take a half hour, what's the difference? You city slickers and your high-falutin' ways.


[Jess in Action][AskingGoodQuestions]
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
From the Wiki: http://en.wikipedia.org/wiki/Time_zone
Newfoundland, India, Iran, Afghanistan, Venezuela, Burma, the Marquesas, as well as parts of Australia use half-hour deviations from standard time, and some nations, such as Nepal, and some provinces, such as the Chatham Islands, use quarter-hour deviations. Some countries, most notably China, use a single time zone even though the extent of their territory far exceeds 15° of longitude.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Thanks for sharing. It's nice when bug reports come with the fix! I did know that there were 30 min offsets, but I wasn't thinking about it when I wrote the original code nor modifying it for JForum. And I didn't know a big country like India used a half hour offset. Always learning new things around these parts.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

The release containing this fix is in production now. Thank you for bringing it up. Please try again.
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3023
    
  35

Thanks Jeanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sri Lanka Standard Time
 
Similar Threads
Reg Custom Time Zone in java.
Encapsulation & Abstraction
Daylight Saving Time in Java5
Changing the timezone of a date, not only display
the biggest internet scam in the history (of Sri Lanka)