Date Format issue.
In DateFormat class,
SHORT is completely numeric, such as 12.13.52 or 3:30pm
MEDIUM is longer, such as Jan 12, 1952
LONG is longer, such as January 12, 1952 or 3:30:32pm
FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.
I am wondering if there is any way to display just month and year , e.g, July 2007. And according to Locale to display the string if in different languages.(which might also mean different format, e.g, year month instead of month year.)
Cheers,
[552 byte] By [
lindda] at [2007-11-27 9:36:50]

Thx for replying. The thing is I dont want to control it by myself. E.g, if Locale is in China, Chinese guys actually prefer to use "year month" which are also in Chinese, not numbers.So if I give it a Locale, is it going to get the corresponding local language string?Ta,
lindda at 2007-7-12 23:06:45 >

What does the API say about it? And have you tried it?Edit:I'm not a Chinese (or any other) local expert (and, AFAIK, neither is anyone else here), so I would also have to simply try it, and since it is your situation, I would say for you to try it first.
yes, i tried a couple of ways.
If I use constructor SimpleDateFormat(String pattern, Locale locale) , it will stay same.
If I use DateFormat.getDateInstance(DateFormat.LONG), since DateFormat only has a few default modes, I cannt really get "year month", although it does come up with the local language.
lindda at 2007-7-12 23:06:45 >

> yes, i tried a couple of ways.
>
> If I use constructor SimpleDateFormat(String pattern,
> Locale locale) , it will stay same.
>
>
> If I use DateFormat.getDateInstance(DateFormat.LONG),
> since DateFormat only has a few default modes, I
> cannt really get "year month", although it does come
> up with the local language.
Well, then, there was your answer. ;-)
If you know that the Chinese locale should be year month, but the Locale provided by Java is not doing that, you may wish to put in an RFE (Request For Enhancement), or a report a Bug, and see if you can get Sun to change it (although they will probably simply claim that it is not a bug, and that you are mistaken (which could also be the case)).
Edit:
Although, I believe in most cases, that the Locale class depends on the locale info provided by the OS, in which case Sun is not at fault (except for Solaris).