Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Settings formats = new Settings();
- Properties SDFFormats = formats.load(propertiesFile);
- String SDFAmerica = SDFFormats.getProperty("FormatAmerica");
- FormatAmerica = MMM-dd-yyyy
- // This is an incredibly ugly hack, but it's based on the fact that
- // Java for some reason decided that Italy uses "." between
- // hours.minutes.seconds, even though "locale" and strftime say
- // something different.
- hmsTimeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM);
- if (hmsTimeFormat instanceof SimpleDateFormat)
- {
- String str = ((SimpleDateFormat)hmsTimeFormat).toPattern();
- str = str.replace('.', ':');
- hmsTimeFormat = new SimpleDateFormat(str);
- }
- SimpleDateFormat sdf = (SimpleDateFormat)sdf.getDateTimeInstance(DateTime.SHORT,DateTime.SHORT, locale);
- if (formatString != null) {
- sdf = new SimpleDateFormat(formatString);
- }
- if (am!= null && pm != null) {
- DateFormatSymbols symbols = sdf.getDateFormatSymbols();
- symbols.setAmPmStrings(new String[]{am, pm});
- sdf.setDateFormatSymbols(symbols);
- }
Add Comment
Please, Sign In to add comment