
Anonymous
Not applicable
2015-06-19
11:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert format (EEE MMM dd HH:mm:ss Z yyyy) to (YYYY-MM-DD)
Hello,
I need to convert format (EEE MMM dd HH:mm:ss Z yyyy) to (YYYY-MM-DD).
Exemple : Mon Nov 22 00:00:00 CET 2004 ----> 2004-11-22
Thanks.
I need to convert format (EEE MMM dd HH:mm:ss Z yyyy) to (YYYY-MM-DD).
Exemple : Mon Nov 22 00:00:00 CET 2004 ----> 2004-11-22
Thanks.
2,268 Views
4 Replies

Anonymous
Not applicable
2015-06-23
04:33 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2,268 Views

Anonymous
Not applicable
2015-10-30
10:20 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
J'ai ajouter le class java suivant pour résoudre le problème :
package routines;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class CONVERT_DATE {
public static Date toDate(String Str) throws ParseException {
DateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US);
Date date1 = (Date)formatter.parse(Str);
Calendar cal = Calendar.getInstance();
cal.setTime(date1);
return date1;
}}
package routines;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class CONVERT_DATE {
public static Date toDate(String Str) throws ParseException {
DateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US);
Date date1 = (Date)formatter.parse(Str);
Calendar cal = Calendar.getInstance();
cal.setTime(date1);
return date1;
}}
2,268 Views

Anonymous
Not applicable
2019-09-05
06:49 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi! I have the same problem and for me the data type is a string. Thanks for helping! @xdshi
2,268 Views

Anonymous
Not applicable
2019-09-24
10:26 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer the below method to convert the string to date in different format.
The function used is as shown below.
TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row1.data)
If you need to convert the output again to String, you can use a tConvertType component or any java string conversion function.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
2,268 Views
