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

Problem with Calendar, Locale,TimeZone

 
Rajesh Hegde
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am trying to get the date in a country based on its time zone and locale. I have used the getInstance method of the "Calendar" Class passing the Locale and time zone as parameters. But Some how it shows the the timezone and locale of the system. Can any one tell me how to get a solution for my problem.
Rajesh
Here is the code for more info :
import java.util.*;
class TestTime
{
public static void main(String a[])
{
SimpleTimeZone TZ=new SimpleTimeZone(18000000,"India");
// 18000000 milliseconds is the difference wrt to GMT
Locale india=new Locale("hi","IN");
Calendar cal=Calendar.getInstance(TZ,india);
System.out.println("Date: = " + cal.getTime());
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic