A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
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,
Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
I agree. Here's the link:
subject: Date using Calendar for a spcific Locale
java.util.date time is different than the system time
java.util.Date getYear() method is deprecated
Chinese Calender Date is not able to parse
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014