List operation Find with date and time

Hi there, I am working on a project but I have a question. i have a attribute with date type of date and time. I also have a list of an entity (with this same date time attribute inside). Now i want to retrieve out of the list of the enitity just the dates that are 7 days apart from the current date. So I tried to use list operation with find but then i have to equal something to the date of the attribute. Also i couldnt find the right expression for that. Can somebody help me please? Thanks. 
2 answers

Hi Ris

first create a new list of the same entity 

Have a loop and pass the list data retrived from data base in the loop

Have some check eg:daysBetween()=7 then store in the newly created list


Hope this helps



You where on the right track. Sollution of Asish does work but it can be done quicker. As you already found out you need to compare some dates. If you also use the time part you need two variables otherwise only the startdate would be enough. You need the start of the day 7 days ago and you need the end of the day 7 days ago. Depending if those dates are localized or not use either the UTC versions of the commands. My examples are if you use no localization so everything is in UTC. To create the variable use beginDay with the expression addDaysUTC([%BeginOfCurrentDayUTC%],-7) and endDay with the expression addDaysUTC([%EndOfCurrentDayUTC%],-7). If you already have the list you can use filter to get all the records of use find to find the first record. You can then use the expression $beginDay <= $yourEntity/yourdate and $endDay >= $yourEntity/yourdate. This way you do not have to iterate over the list. You could also use it on an Xpath when doing a database retrieve to inmediately find those records,