Inconsistent Date field while fetching from csv to postgresSQL !!!

Four Stars

Inconsistent Date field while fetching from csv to postgresSQL !!!

Hi Team,

I am using postgreSQL and trying to load a column from one table to another in the same db.

My source column is of VARCHAR type having date values. I am parsing this date and storing it in the target column as "yyyy-MM-dd" format in 'Date' datatype.

Problem: For some record the value is coming fine but for some records the date field is coming as one day before the actual date.

Conversion from string to date is as : 

row5.seniority_date==null || row5.seniority_date.isEmpty() || row5.seniority_date.equals(" ")? null : TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",(row5.seniority_date))))

Please find attached screenshot for the same. Please help me to resolve this.

 

DateIssue.PNG

Nine Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

In case you are storing row5.seniority_date as varchar, I suggest you try :

TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row2.seniority_date)

I should normaly convert the varchar to date.
If you want to remove time, I suggest you first use StringHandling.LEFT(row2.seniority_date,10) to extract only date without time before convert to date
Regards
DGM
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

Still facing the same issue.


Eight Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

Hi @gervit14 ,

 

In that case can you please try TalendDate.parseDate("yyyy-MM-dd",row5.seniority_date.substring(0,10))

 

Thanks and Regards,

Subhadip

Four Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

Hi Subhadip,

The issue still persists. Still I am getting inconsistent data.


Nine Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

I'm not sure it's date conversion the issue
Regards
DGM
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Inconsistent Date field while fetching from csv to postgresSQL !!!

Same I was thinking, may be postgres internal time zone need to be checked or something...


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

Downloads and Trials

Test drive Talend's enterprise products.

Downloads