Hi Everyone,
I’m trying to subtract 3 days from the current system date. I’m trying this syntax,
now.AddDays(-3).ToString(“ddMMyyyy”) and just return the value days minus 3.
My expectation is when the current date “06122021” and I want to substract 3 days before current date “03122021”, “04122021”, and “05122021”.
Thank you in advance.
Regards
Anggara
Gokul001
(Gokul Balaji)
December 6, 2021, 7:15am
2
Hi @Anggara_Rahmadhani
Try the Below Expression
DateTime.ParseExact(DateTime.Now.ToString("ddMMyyyy"),("ddMMyyyy"),Globalization.CultureInfo.InvariantCulture).AddDays(-3).ToString(“ddMMyyyy”)
Regards
Gokul
Jobin_Joy
(Jobin Joy)
December 6, 2021, 7:20am
3
Hi @Anggara_Rahmadhani
Is this your requirement?
Thank you.
Hi @Gokul001 @Jobin_Joy
Your syntax is just a return the value days minus 3 it means “03122021”.
My expectation is when the current date “06122021” and I want to substract 3 days before current date “03122021”, “04122021”, and “05122021”.
Gokul001
(Gokul Balaji)
December 6, 2021, 7:25am
5
Hi @Anggara_Rahmadhani
You can Try with 3 different Assign and store the Value in the Variable
Sub1 = DateTime.ParseExact(DateTime.Now.ToString(“ddMMyyyy”),(“ddMMyyyy”),Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToString(“ddMMyyyy”)
Sub2 = DateTime.ParseExact(DateTime.Now.ToString(“ddMMyyyy”),(“ddMMyyyy”),Globalization.CultureInfo.InvariantCulture).AddDays(-2).ToString(“ddMMyyyy”)
Sub3 = DateTime.ParseExact(DateTime.Now.ToString(“ddMMyyyy”),(“ddMMyyyy”),Globalization.CultureInfo.InvariantCulture).AddDays(-3).ToString(“ddMMyyyy”)
Regards
Gokul
Ya that is my solution before, but is it possible with 1 assign value to substract 3 days?
Gokul001
(Gokul Balaji)
December 6, 2021, 7:34am
7
Hi @Anggara_Rahmadhani
You can Try with an Single Assign activity
DateTime.Now.AddDays(-1).ToString("ddMMyyyy")+" "+DateTime.Now.AddDays(-2).
ToString("ddMMyyyy")+" "+DateTime.Now.AddDays(-3).ToString("ddMMyyyy")
Regards
Gokul
Hi @Anggara_Rahmadhani ,
Hope this workflow will help you
arrDays.xaml (6.3 KB)
ppr
(Peter Preuss)
December 6, 2021, 9:42am
10
Enumerable.Range(1,3).Select(Function (x) now.Date.AddDays(-x)).Reverse().toArray
Enumerable.Range(1,3).Select(Function (x) now.Date.AddDays(-x).ToString("ddMMyyyy")).Reverse().toArray
3 Likes
Hi @ppr
Thanks a lot, by using function it is working as expected.
Best Regards.
Hi @tranthao240495
Thanks for your suggestion, really appreciate it!
Hi @Divyanshu_Divyanshu
Thanks for your suggestion, really appreciate it!
Hi @Gokul001
Thanks for your suggestion, really appreciate it!
system
(system)
Closed
December 9, 2021, 10:06am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.