Hi @Farhan Jamil ,
Do you mean you want to get previous date and the format is like 02nd December 2021 and today is 12/3/2021?If I misunderstand your need, please incorrect me.
Check below to see if it could meet your requirement.
Create three variables.
Name: Expression
- Ydate: dateadd("day", -1, getdate())
- Date2 RIGHT("0" + (DT_WSTR,2)DAY( @[User::Ydate] ), 2)
- DateExt @[User::Date2]=="01"?"st":@[User::Date2]=="21"?"st":@[User::Date2]=="02"?"nd":@[User::Date2]=="22"?"nd":@[User::Date2]=="03"?"rd":@[User::Date2]=="23"?"rd":"th"
Combine them with below code:
@[User::Date2] +@[User::DateExt]+" "+(MONTH(@[User::Ydate]) == 1 ? "Jan" : MONTH(@[User::Ydate]) == 2 ? "Feb" : MONTH(@[User::Ydate]) == 3 ? "Mar" :
MONTH(@[User::Ydate]) == 4 ? "Apr" : MONTH(@[User::Ydate]) == 5 ? "May" : MONTH(@[User::Ydate]) == 6 ? "Jun" :
MONTH(@[User::Ydate]) == 7 ? "Jul" : MONTH(@[User::Ydate]) == 8 ? "Aug" : MONTH(@[User::Ydate]) == 9 ? "Sep" :
MONTH(@[User::Ydate]) == 10 ? "Oct" : MONTH(@[User::Ydate]) == 11 ? "Nov" : MONTH(@[User::Ydate]) == 12? "Dec":"")+" " +RIGHT("0" + (DT_STR,4,1252)DATEPART( "yyyy" , @[User::Ydate] ), 4)
Regards,
Zoe
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.