Changeset 26279 for main/trunk/greenstone3/src
- Timestamp:
- 2012-10-04T10:15:44+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java
r26253 r26279 44 44 protected static HashMap<String, ArrayList<String>> _foundTableValues = new HashMap<String, ArrayList<String>>(); 45 45 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.XSLTUtil.class.getName()); 46 46 protected static HashMap<String, String> _stringVariables = new HashMap<String, String>(); 47 48 public static void storeString(String name, String value) 49 { 50 _stringVariables.put(name, value); 51 } 52 53 public static String getString(String name) 54 { 55 return _stringVariables.get(name); 56 } 57 47 58 /* some tests */ 48 59 public static boolean equals(String s1, String s2) … … 393 404 public static String formatDate(String date, String lang) 394 405 { 395 396 406 String in_pattern = "yyyyMMdd"; 397 407 String out_pattern = "dd MMMM yyyy"; … … 414 424 } 415 425 426 } 427 428 public static String getDetailFromDate(String date, String detail, String lang) 429 { 430 String in_pattern = "yyyyMMdd"; 431 if (date.length() == 6) 432 { 433 in_pattern = "yyyyMM"; 434 } 435 436 SimpleDateFormat formatter = new SimpleDateFormat(in_pattern, new Locale(lang)); 437 try 438 { 439 Date d = formatter.parse(date); 440 if (detail.toLowerCase().equals("day")) 441 { 442 formatter.applyPattern("dd"); 443 } 444 else if (detail.toLowerCase().equals("month")) 445 { 446 formatter.applyPattern("MMMM"); 447 } 448 else if (detail.toLowerCase().equals("year")) 449 { 450 formatter.applyPattern("yyyy"); 451 } 452 else 453 { 454 return ""; 455 } 456 return formatter.format(d); 457 } 458 catch (Exception ex) 459 { 460 return ""; 461 } 416 462 } 417 463
Note:
See TracChangeset
for help on using the changeset viewer.