# Data Filter Query, Current Time Variable (Date)

**URL:** <https://community.neo4j.com/t/data-filter-query-current-time-variable-date/41443>\
**Category:** Cypher\
**Tags:** cypher, import, knowledge-base\
**Created:** [July 15, 2021, 1:42pm UTC](https://community.neo4j.com/t/data-filter-query-current-time-variable-date/41443 "2021-07-15T13:42:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarayyehud](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sarayyehud/32/18916_2.png) [@sarayyehud](https://community.neo4j.com/u/sarayyehud)\
**Post date:** [July 15, 2021, 1:42pm UTC](https://community.neo4j.com/t/data-filter-query-current-time-variable-date/41443/1 "2021-07-15T13:42:50Z")

</div>

Hi, I'm trying to think of a shorter and understandable code for my question.  
I would love ideas and suggestions. This is my question and code.

**MATCH** (p:Person)-[:Has\_FB\_Frienship\_With]-(n:Person)

**WHERE** date().year-p.BirthYear\<=12 AND date().year-n.BirthYear\>=20 AND p.Gender\<\>n.Gender

**RETURN** p.PersonID **AS** younger\_id, p.First\_name **AS** younger\_F\_name,p.Last\_name **AS** younger\_L\_name, p.Gender **AS** Younger\_Gender,date().year-p.BirthYear **AS** younger\_Age, n.PersonID **AS** older\_id, n.First\_name **AS** older\_F\_name,n.Last\_name **AS** older\_L\_name, n.Gender **AS** Older\_Gender, date().year-n.BirthYear **AS** older\_Age

For reasons of caution and child protection, a particular supervisory body wants to locate friendships between two people that meet  
The following criteria:  
a) They are of a different gender.  
b) one of them is less than 12 and the other is greater than 20.  
Note: To calculate the age one must of course use the parameter of the current year. Do not write it  
As usual, but use the Cypher variable (so that the query will run properly in the coming years as well)
