How to make Date locale-independent?

Posted by folone on Stack Overflow See other posts from Stack Overflow or by folone
Published on 2010-04-23T09:42:37Z Indexed on 2010/04/23 10:03 UTC
Read the original article Hit count: 240

Filed under:
|
|

I have a db, that stores dates in OleDateTime format, in GMT timezone. I've implemented a class, extending Date in java to represent that in classic date format. But my class is locale-dependent (I'm in GMT+2). Therefore, it converts the date in the db as date - 2 hours. How do I make it convert the date correctly? I want my class to be locale-independent, always using GMT timezone. Actually, the question is:

class MyOleDateTime extends Date {

    static {
        Locale.setDefault(WhatGoesHere?)
    }

    // ... some constructors
    // ... some methods
}

© Stack Overflow or respective owner

Related posts about java

Related posts about gmt