dcsimg
time formating
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   greg_greg
Posted On:   Sunday, January 20, 2002 03:47 PM

Hello, I need to format time according to the locale. "Unfortunately", I only need to display hours.. that is "13" or "1PM" for instance, not the full time. I didn't find any solution to do that with the DateFormat classes, as it has separate fields for "24h a day", "2*12" + the "am/pm indicator". Can anyone help me with this? (Actually it might be helpful to have in mind that i need to loop through hours, that is display from 1AM to 12PM or 1 to 24, or 0 to 23, etc...) [i also tried to do that through the dateFormat.getCalendar() method, but it didn't seem to update the internal calendar of the dateformat when i did a roll on it...] thanks    More>>

Hello,

I need to format time according to the locale. "Unfortunately", I only need to display hours.. that is "13" or "1PM" for instance, not the full time. I didn't find any solution to do that with the DateFormat classes, as it has separate fields for "24h a day", "2*12" + the "am/pm indicator".

Can anyone help me with this?
(Actually it might be helpful to have in mind that i need to loop through hours, that is display from 1AM to 12PM or 1 to 24, or 0 to 23, etc...)
[i also tried to do that through the dateFormat.getCalendar() method, but it didn't seem to update the internal calendar of the dateformat when i did a roll on it...]

thanks

Greg

   <<Less

Re: time formating

Posted By:   Christopher_Schultz  
Posted On:   Monday, January 21, 2002 05:27 AM

Check into the SimpleDateFromat class. You can create one of these with a String argument where you specify the exact format of the message.



If you are worried about localization, then you can have this format String be in a locale-specific properties file.



Hope that helps,

-chris
About | Sitemap | Contact