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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 602
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: 35
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: 9946
    
    6

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


Never ascribe to malice that which can be adequately explained by stupidity.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to decide EST or EDT in java program
 
Similar Threads
How to convert time zones
Convert a String with a date valus for Oracle
want client's time zone from server side
want client's time zone from server side
Daylight Saving Time in Java5