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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
talendtester
Creator III
Creator III

[resolved] date math - how can Talend add or subtract X number of days?

How can you add or subtract X number of days with Talend?
For example my date is '2013-04- 22' how can Talend subtract 5 days and return '2013-04- 17'?
Labels (2)
1 Solution

Accepted Solutions
_AnonymousUser
Specialist III
Specialist III

You can use following expression to move date 5 days back

TalendDate.addDate("2013-04-22","yyyy-MM-dd",-5,"dd")

View solution in original post

8 Replies
_AnonymousUser
Specialist III
Specialist III

You can use following expression to move date 5 days back

TalendDate.addDate("2013-04-22","yyyy-MM-dd",-5,"dd")
talendtester
Creator III
Creator III
Author

Thanks oz69! Works great.
tYrannoSaurusRex_1
Contributor III
Contributor III

I have a excel sheet where Column B is a date and Column E is a number. I want number of days in Column E to be reduced from Column B and stored in Column F
Input be like,
Column B|Column E|Column F
2014-05-13|4|
2014-06-12|2|
Output be like,
Column B|Column E|Column F
2014-05-13|4|2014-05-09
2014-06-12|2|2014-06-10
Anybody up for help??
Jcs19
Creator II
Creator II

hi guru,
use tmap

Expression of column F:
TalendDate.addDate(row1.columnB,"yyyy-MM-dd",-row1.columnE,"dd")
tYrannoSaurusRex_1
Contributor III
Contributor III

Hi Jcs19,
You are subtracting date from date... I need to subtract number of days from date...
Jcs19
Creator II
Creator II

Hi Jcs19,
You are subtracting date from date... I need to subtract number of days from date...

What?
I thought you wanted column F = Column B(date) - Column E(number of day)
In my example, i'm subtracting column E as number of day to column B to make column F
tYrannoSaurusRex_1
Contributor III
Contributor III

but the datatytpe shown in expression editor is date and not integer
Jcs19
Creator II
Creator II

but the datatytpe shown in expression editor is date and not integer

Oh yes, column E should be integer not date (I made this example too fast 0683p000009MAB6.png)