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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Problem with Calendar, Locale,TimeZone
 
Similar Threads
settimezone on gregorian calendar doesn't work !!
calendar time viewed by differing timezone
calendar timezone
Get date and time using TimeZone.
calendar.getInstance()