----------String 2 Date Conversion Example------
String a="2016-01-23";
Date d=TalendDate.parseDate("yyyy-MM-dd", a);
System.out.println("\nInput String ------ "+a);
System.out.println("\nOutput Converted Date------"+d);
RESULT :
Input String ------ 2016-01-23
Output Converted Date------Sat Jan 23 00:00:00 IST 2016
----------Date 2 String Conversion Example------
String a1="2016-01-23";
Date d1=TalendDate.parseDate("yyyy-MM-dd", a1);
String b1=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",d1);
System.out.println("\nInput Date ------ "+d1);
System.out.println("\nOutput Converted String------"+b1);
RESULT :
Input Date ------ Sat Jan 23 00:00:00 IST 2016
Output Converted String------2016-01-23 00:00:00
----------Date Conversion with AM/PM Example------
String a5="2016-01-23 12:30:45 AM";
Date d5=TalendDate.parseDate("yyyy-MM-dd HH:mm:ss aa", a5);
System.out.println("\nInput String ------ "+a5);
System.out.println("\nOutput Converted Date------"+d5);
String b7=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss aa",d5);
System.out.println("\nOutput Converted String------"+b7);
RESULT :
Input String ------ 2016-01-23 12:30:45 AM
Output Converted Date------Sat Jan 23 12:30:45 IST 2016
Output Converted String------2016-01-23 12:30:45 PM
String a="2016-01-23";
Date d=TalendDate.parseDate("yyyy-MM-dd", a);
System.out.println("\nInput String ------ "+a);
System.out.println("\nOutput Converted Date------"+d);
RESULT :
Input String ------ 2016-01-23
Output Converted Date------Sat Jan 23 00:00:00 IST 2016
----------Date 2 String Conversion Example------
String a1="2016-01-23";
Date d1=TalendDate.parseDate("yyyy-MM-dd", a1);
String b1=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",d1);
System.out.println("\nInput Date ------ "+d1);
System.out.println("\nOutput Converted String------"+b1);
RESULT :
Input Date ------ Sat Jan 23 00:00:00 IST 2016
Output Converted String------2016-01-23 00:00:00
----------Date Conversion with AM/PM Example------
String a5="2016-01-23 12:30:45 AM";
Date d5=TalendDate.parseDate("yyyy-MM-dd HH:mm:ss aa", a5);
System.out.println("\nInput String ------ "+a5);
System.out.println("\nOutput Converted Date------"+d5);
String b7=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss aa",d5);
System.out.println("\nOutput Converted String------"+b7);
RESULT :
Input String ------ 2016-01-23 12:30:45 AM
Output Converted Date------Sat Jan 23 12:30:45 IST 2016
Output Converted String------2016-01-23 12:30:45 PM