Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-06-13
3
Medium Priority
?
195 Views
Last Modified: 2010-03-31


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
Comment
Question by:cutie_smily
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16898318
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
 
LVL 5

Accepted Solution

by:
tbboyett earned 750 total points
ID: 16898978
Locale locale = Locale.US;
java.util.Calendar calendar = java.util.Calendar.getInstance( locale );

http://www.erights.org/javadoc/java/util/Locale.html
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16900640
Yes, the OS time-zone has to be changed and Java will pick it up
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question