Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Subtraction in Expression

Status
Not open for further replies.

IAMINFO

MIS
Feb 21, 2002
62
US
Hello everyone I am totally stuck, I am trying to subtract 1 day from the day part of this expression, appreciate your help, thank you for reading the post.


@[User::FileDate] +
(DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".csv
 
Thanks everyone I figured it out. Here is the syntax if anyone needs it

@[User::FileDate]
+ (DT_WSTR,4)YEAR(DATEADD("dd", -1, GETDATE())) + "-" + RIGHT("0" + (DT_WSTR,2)MONTH(DATEADD("dd", -1, GETDATE())), 2) + "-" + RIGHT("0" + (DT_WSTR,2)DAY(DATEADD("dd", -1, GETDATE())), 2) + ".csv
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top