File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Problem with Calendar, Locale,TimeZone Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with Calendar, Locale,TimeZone" Watch "Problem with Calendar, Locale,TimeZone" New topic
Author

Problem with Calendar, Locale,TimeZone

Rajesh Hegde
Ranch Hand

Joined: Sep 15, 2000
Posts: 112
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());
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Calendar, Locale,TimeZone