Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] how to insert a 0000-00-00 date in a field using talend?

Hi
I'm trying to insert a "0000-00-00 " in date' field , bu i don't know how?
any ideas?

Mouad
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
I think any database doesn't allow "0000-00-00".
Insert "0001-01-01" instead of "0000-00-00" in date filed.
Thanks,
kumar

View solution in original post

12 Replies
Anonymous
Not applicable
Author

You need to explain better what you're trying to do.
First issue is that this is not a date.
It may, of course, mean something to wherever you're trying to put it...
Anonymous
Not applicable
Author

Hi,
Apparently he wants to insert a default value in the date field...I want to do the same thing but it does not work ...
I want to insert a default value in my date field because null values are not allowed in that field
is there a way to do that ?
Thanks,
Rajaa
Anonymous
Not applicable
Author

Hi,
Do a trick
In the date field subtract two date current date from current date you will get all 0000-00-00. Use expression to check if the input date is null then do above operation.
Thanks
Vaibhav
Anonymous
Not applicable
Author

Hi,
How to make the difference between two dates , and insert a date value (0000-00-00) in a field of date's type?
thank u
Regards
Anonymous
Not applicable
Author

you can do it using two way.
1:- TalendDate.compareDate(date1, date2)
the result wheather two date is the same, if first one less than second one return number -1,
equlas return number 0,
bigger than return number 1.
{example} compareDate(2008/11/24 12:15:25, 2008/11/24 16:10:35) return -1 #
2:-TalendDate.diffDate(date1, date2, dateType)
a number of years, months, days ... date1 - date2
{examples} ->>
diffDate(2008/11/24 12:15:25, 2008/10/14 16:10:35, "yyyy") : return 0
->> diffDate(2008/11/24 12:15:25, 2008/10/14 16:10:35, "MM") : return 1
->> diffDate(2008/11/24 12:15:25, 2008/10/14 16:10:35, "dd") : return 41
Anonymous
Not applicable
Author

Hi
thanks for your reply ,
i just want to get the "0000-00-00" (return type is date) at the end to insert it in my field , how can i do that ?
"here is my script but it's not working :
TalendDate.parseDate("dd-MM-yyyy",String.valueOf((TalendDate.diffDate(TalendDate.getCurrentDate(),TalendDate.getCurrentDate()))))

regards
Anonymous
Not applicable
Author

Hi,
You want "0000-00-00" for all the records
or
Instead of Null values you are going to insert "0000-00-00"
Thanks,
kumar
Anonymous
Not applicable
Author

i want to do the second choice :
Instead of Null values you are going to insert "0000-00-00"
thanks
Regards 0683p000009MACn.png
Anonymous
Not applicable
Author

try this, but i don`t think so any database allows to insert such value if any please do post here for reference.

TalendDate.parseDate("yyyy-MM-dd","0000.00.00");