Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Piece of code for converting date and time depending on country's



For example , i place my latop in dubai

java code should display time and date of dubai (6/13/06 and time: 12:30p.m)

if united states (6/12/06 time:united states time)



0
cutie_smily
Asked:
cutie_smily
1 Solution
 
objectsCommented:
You need to change the timezone your laptop is setup for.
Your java application will by default display the time using the current timezone.
0
 
tbboyettCommented:
Locale locale = Locale.US;
java.util.Calendar calendar = java.util.Calendar.getInstance( locale );

http://www.erights.org/javadoc/java/util/Locale.html
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Yes, the OS time-zone has to be changed and Java will pick it up
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now