Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Talend Date format YYYY-MM-DD

Hi there,
I'm building a job that takes dates from an Excel spreadsheet. In tMap I use the date format for the input and output row on this particular date field: "yyyy-MM-dd'T'HH:mm:ss" and it rightly gives a delimited output of '2014-09-17T00:00:00. But in a further ETL process I am required to give the date format as YYYY-MM-DD. How can I strip out the 'HH:mm:ss as I can't find the exact date format in the possible formats available in Talend.
Thanks.
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
Try with: 
1)TalendDate.formatDate("yyyy-MM-dd",row6.DATE)-->> it convert date to string.
2)TalendDate.parseDate( "yyyy-MM-dd",row6.DATE)-->> it convert string to date
Regards,
kumar.talend

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi,
Try with: 
1)TalendDate.formatDate("yyyy-MM-dd",row6.DATE)-->> it convert date to string.
2)TalendDate.parseDate( "yyyy-MM-dd",row6.DATE)-->> it convert string to date
Regards,
kumar.talend
Anonymous
Not applicable
Author

you can try below way it will parse your mention string. 
TalendDate.parseDate(“yyyy-MM-dd’T’HH:mm:ss?,” 2014-09-17T00:00:00 ?);
You can see more date formats here.
Anonymous
Not applicable
Author

Hey try  UMESHRAKHE  Solution

0683p000009MD8J.pngFor ripping of HH:MM 0683p000009M9p6.pngS
0683p000009MD2l.png
0683p000009MD8O.png
Anonymous
Not applicable
Author

@Kumar Talend. Excellent! Your solution works like magic.
@umeshrakhe and kiranpariyarath. Thanks for your solutions too.
Anonymous
Not applicable
Author

Hi,
0683p000009MACn.png 0683p000009MA9p.png
Regards,
kumar.talend
Anonymous
Not applicable
Author

Hi All,
I have situation regarding Milliseconds to Date Conversion.
There are 2 columns in excell sheet which contains only millisecond values and that have to convert into a Given Date format
Please take following table as Source table..
TRISTARTDATEDA    TRIENDDATEDA
1425148200             1423074600
1423074600             1482604200

Expected Outcome...
TRISTARTDATEDA    TRIENDDATEDA
01-03-2015             05-02-2015
05-02-2015             25-12-2016


Please kindly suggest me solution for this .
I am Waiting for positive reply

Thanks in Advance,
Shri_Kul1
Talend User
_AnonymousUser
Specialist III
Specialist III

Hi Umesh,
Do you have solution for the issue i am getting?
Anonymous
Not applicable
Author

Hi  Shri_Kul1,
You can use java code to do so in talend using tjavarow.
Please have a look at these : 
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public class Timeconversion
{
   DateFormat dfm = new SimpleDateFormat("yyyyMMddHHmm");  
   long unixtime;
   public long timeConversion(String time)
   {
       dfm.setTimeZone(TimeZone.getTimeZone("GMT 5:30"));//Specify your timezone
   try
   {
       unixtime = dfm.parse(time).getTime();  
       unixtime=unixtime/1000;
   }
   catch (ParseException e)
   {
       e.printStackTrace();
   }
   return unixtime;
   }
}

or you can use the below topic : 
https://community.talend.com/t5/Design-and-Development/convert-the-unix-timestamp/td-p/83249