I am creating web application where I need to store timestamp/ date.
The problem is that I have hosted my site on one of the hosting site and hosting site is based on US. When the data is store, US timing are store and not my own country timing.
I believe I need to set the hosting server time to my country timing OR I need to convert the time before I save. I tried few code, however I am not getting.
Could someone help me how to convert the time in java?
When I print
System.out.println(new Date());
I get US time and not my current time. I need to convert this time to show as per My country time i.e. Kuwait timing.
Edit 1
When I print date as System.out.println(new Date());
, I get output as Thu Sep 06 11:07:49 EDT 2012
which means I am getting server time.
Now I want to convert this time to some country time, lets say Kuwait OR Any other country i.e. same time should be displayed as current country.
i.e. the time for country Kuwait should be Thu Sep 06 19:07:49 AST 2012
For India it should be Thu Sep 06 21:37:49 IST 2012
Edit 2
Questions with better wording Hope So
I have created a web application using JSF where my server is in US. I am storing timestamp
in database. Now while printing the time, I will obviously get the time that is there in DB i.e. US data.
I am preparing report where I want to display data along-with timings.
+++++++++++++++++++++++++++++++++++
+ Name + Time +
+++++++++++++++++++++++++++++++++++
+ Name 1 + 10/09/2012 10:11 +
+ Name 2 + 10/09/2012 21:11 +
+ Name 3 + 10/09/2012 17:11 +
+++++++++++++++++++++++++++++++++++
Now the problem is that those timings are as per US timing hence I need to convert those US timing to my country time where I am. I need to display this time where I am accessing internet i.e. if I am in kuwait, I need those timings as per Kuwait timings. If I am accessing this data in Dubai, I need to display report as per Dubai timings.
Could someone help how could I get rid of these problem?