File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Customer Requirements for Developers
this week in the
Java in General
Date using Calendar for a spcific Locale
Joined: Jan 05, 2009
Feb 19, 2011 01:57:49
I tried the following but it didn't work as expected:
Locale localeItaly = new Locale("it"); Calendar calendar = Calendar.getInstance(localeItaly); Date dateItaly = calendar.getTime(); System.out.println("Date in Italy = "+dateItaly);
which printed :
Date in Italy = Sat Feb 19 14:26:32 IST 2011
I was expecting it to print the current date in Italy.
Can anyone explain?
Joined: Sep 08, 2007
Feb 19, 2011 03:00:59
You could try using Locale.ITALY instead of "it".
Mohamed Sanaulla |
Joined: Oct 24, 2010
Feb 19, 2011 04:37:29
Rather than just trying things, I suggest you refer to the API,
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
I agree. Here's the link:
subject: Date using Calendar for a spcific Locale
Chinese Calender Date is not able to parse
java.util.Date getYear() method is deprecated
java.util.date time is different than the system time
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015