Only show rows from dates in the last 7 days

Hi @paul.placintar, could you help how can i filter command Date1=today and Date2=today-7 , and then out put to excel sheet 2.

Hi @kaungset, you could use the DateTime.Compare function

Documentation: DateTime.Compare

As for the code, I would do something like below

assuming date1 and date2 are DateTime variables

If (DateTime.compare(date1,now) and DateTime.Compare(date2,now.addDays(-7) ) then
   'do something
end if

DateTime.AddDays accepts negative integers so you can increase or decrease the days from a date as you like

Hope this helps,
Good luck

1 Like