- static public String FormatDate(String input) throws ParseException {
- if (input != null) {
- SimpleDateFormat oldFormate = new SimpleDateFormat();
- oldFormate.applyPattern("yyyyMMddHHmmss");
- // System.out.println("input::"+input);
- Date dt = oldFormate.parse(input);
- // System.out.println("Date::"+dt);
- SimpleDateFormat newFormate = new SimpleDateFormat();
- newFormate.applyPattern("dd-MM-yyyy HH:mm:ss");
- return newFormate.format(dt);
- }
- else
- {
- return input;
- }
- }
"Learning gives Creativity,Creativity leads to Thinking, Thinking provides Knowledge, Knowledge makes you Great"
Monday, 16 September 2013
Java: Change one date format to another formate
Labels:
Core Java
Subscribe to:
Post Comments (Atom)
RELATED POSTS
No comments:
Post a Comment