Hi there Paul - sorry I never got back to you earlier on this. I chose the same option as Yek (below).
Mihai's suggestion is good for learning how the locale affects the output though. Regards - Wayne Riesterer On Mar 2, 5:47 am, Paul Wigham <paulrwig...@gmail.com> wrote: > Hi Wayne, > > I have just got to the same homework and am also struggling with how > the Locale fits in with the output of Calendar.DATE and Calendar.HOUR > as there doesn't seem to be a way of varying this by passing a > different Locale. Isn't the use of Locale.getDefault() and > Locale.GERMAN for translating such items as the Month? > > Did you manage to get anywhere with this at all? Any input would be > great. > > Cheers, > Paul > > On Feb 17, 4:41 am, Wayne Riesterer <nexus...@westnet.com.au> wrote: > > > > > Hello there JavaBeans :) > > > I'm struggling to work out a method of completing the homework > > exercise for java_util. > > > Here is the task: > > > "Display the Calendar.DATE, Calendar.HOUR using the locale of your > > country (you can use Locale.getDefault()) and German" (taken from > > javase_utilclasses/index.html) > > > I thought that I could use the getDisplayName() method and pass in the > > appropriate arguments. When I did this, however, I kept getting null > > values for both Calendar.DATE and Calendar.HOUR fields. I checked the > > API documentation and saw that both of these fields are just Integer > > data types. In fact Calendar.DATE is a synonym for > > Calendar.DAY_OF_MONTH and simply reports what day number of the month > > it is. > > > So, I'm wondering, how would Locale apply in this situation? I even > > thought that if I tried other locales, there may be some kind of > > difference - but there didn't appear to be any variation at all. > > > I ended up passing two locales to a display method that created > > Calendar objects using the provided locales. Once this was done, the > > display method then displayed the Calendar.DATE and Calendar.HOUR > > fields as required. > > > It doesn't seem quite right though. I was even considering changing > > the time zones just to make the application seem like it is actually > > doing something useful - by this wasn't specified in the homework > > description. I don't want to submit my homework if I'm not quite sure > > that I've done it correctly. > > > Any ideas, comments, ...abuse etc? > > > Regards - Wayne (fellow JavaBean) -- To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en