aspose file tools*
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
Author

How to decide EST or EDT in java program

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 613
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.


Thanks
Trupti
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");

estFormat.setTimeZone(gmtTime);

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
Bartender

Joined: Oct 02, 2003
Posts: 11479
    
  16

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
 
wood burning stoves
 
subject: How to decide EST or EDT in java program