[resolved] Talend Date format YYYY-MM-DD

One Star

[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.

Accepted Solutions
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

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

All Replies
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

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
Five Stars

Re: [resolved] Talend Date format YYYY-MM-DD

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.

Re: [resolved] Talend Date format YYYY-MM-DD

Hey try UMESHRAKHE Solution

For ripping of HH:MMSmiley FrustratedS

Highlighted
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

@Kumar Talend. Excellent! Your solution works like magic.
@umeshrakhe and kiranpariyarath. Thanks for your solutions too.
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

Hi,
Smiley HappySmiley Wink
Regards,
kumar.talend
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

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
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

Hi Umesh,
Do you have solution for the issue i am getting?
One Star

Re: [resolved] Talend Date format YYYY-MM-DD

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://www.talendforge.org/forum/viewtopic.php?id=47516

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog