Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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
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-2013