File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes How to decide EST or EDT in java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to decide EST or EDT in java program" Watch "How to decide EST or EDT in java program" New topic

How to decide EST or EDT in java program

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 614
In the code, I am trying to query oracle databse based on date. This date is stored in EST or EDT in Oracle table.
In order to query the DB, I need to convert the incoming date on the request from GMT to EST or EDT format. How can one decide to use what format? (EST or EDT). How can this be achieved in java program.

Afzal Rehman
Ranch Hand

Joined: Dec 16, 2009
Posts: 39
Hi ,

As you said data stored in EST format.

so First thing you need to convert the data from EST to GMT.
i am trying to give you idea then sorted out yourself whatever you want to achieve

// Create the Date

Date d = new Date();

get that particular date from your database field

DateFormat gmt= new SimpleDateFormat();
TimeZone gmtTime = TimeZone.getTimeZone("GMT");


gmtFormat.format(date); convert this toString

Then you would have in GMT format.

This is hint may be you can figureout whatever you want to achieve.

Best Regards

SCJP 6.0
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

how do you know how it's stored in the database? In other words, what rules were used to store it?

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: How to decide EST or EDT in java program
It's not a secret anymore!