Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to decide EST or EDT in java program

 
trupti nigam
Ranch Hand
Posts: 627
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
fred rosenberger
lowercase baba
Bartender
Posts: 12125
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do you know how it's stored in the database? In other words, what rules were used to store it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic