# Getting all records from a certain year using datetime field

**URL:** <https://community.postman.com/t/getting-all-records-from-a-certain-year-using-datetime-field/39725>\
**Category:** Help Hub\
**Created:** [October 3, 2022, 12:37pm UTC](https://community.postman.com/t/getting-all-records-from-a-certain-year-using-datetime-field/39725 "2022-10-03T12:37:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joint-operations-pa2](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joint-operations-pa2](https://community.postman.com/u/joint-operations-pa2)\
**Post date:** [October 3, 2022, 12:37pm UTC](https://community.postman.com/t/getting-all-records-from-a-certain-year-using-datetime-field/39725/1 "2022-10-03T12:37:53Z")

</div>

**Your question may already have an answer on the community forum. Please search for related topics, and then read through the [guidelines](https://community.postman.com/t/about-the-just-getting-started-category/37) before creating a new topic.**

> Here’s an outline with best practices for making your inquiry.

_My question_:  
Hello,  
I am a beginner and have some trouble with postman’s syntax. I couldn’t find the answer elsewhere - if it is already there, I will appreciate a link 🙂

I have a table (called event) that contains an ISO formatted date-time field (called eventdate). how can I send a get request to extract all records that occurred in a certain year (2021)?

example from the event table:  
{  
“url”: “[http://localhost:8000/event/1/](http://localhost:8000/event/1/)”,  
“field1”: “a”,  
“eventdate”: “2022-09-21T08:07:20Z”,  
},  
{  
“url”: “[http://localhost:8000/event/2/](http://localhost:8000/event/2/)”,  
“field1”: “b”,  
“eventdate”: “2022-09-22T13:30:50Z”,  
}

I tried  
[http://localhost:8000/event?year(eventdate)=2021](http://localhost:8000/event?year(eventdate)=2021)  
and  
[http://localhost:8000/event?eventdate.year=2021](http://localhost:8000/event?eventdate.year=2021)

thanks,

---

<div class="post-metadata">

**Author:** ![idiotintech](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@idiotintech](https://community.postman.com/u/idiotintech)\
**Post date:** [October 17, 2022, 11:53pm UTC](https://community.postman.com/t/getting-all-records-from-a-certain-year-using-datetime-field/39725/2 "2022-10-17T23:53:58Z")

</div>

This might help

> [@How to verify if ISO date on a endDate endPoint is not expired](https://community.postman.com/t/how-to-verify-if-iso-date-on-a-enddate-endpoint-is-not-expired/39628/2):
>
> Consider the following. (I’m just working with the date, you will have to extend the code if you want the time stamp). You need the date format to be consistent to do the assertion. So first step is to create two variables with the same format for the comparison. Moment also creates a string, so you need to parse it to a number. I’ve set the format to YYYYMMDD as its just a number comparison then. Pretty sure you can do date comparison if you format the variable as a date object correctly…
