# Graphiql Filter by Current Date

**URL:** <https://community.hubspot.com/t/graphiql-filter-by-current-date/118932>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [October 22, 2024, 5:03pm UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932 "2024-10-22T17:03:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LSeth](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lseth/32/48165_2.png) [@LSeth](https://community.hubspot.com/u/LSeth)\
**Post date:** [October 22, 2024, 5:03pm UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/1 "2024-10-22T17:03:06Z")

</div>

Hello. I have a custom object that has a date property. In the graphiql query can I filter by that date property to only show records that have a date newer than the current date? The only way I have been able to filter in the graphiql playground is by setting a date in ISO 8601 format. I was hoping there is a way to get the current to filter from. Thanks.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 23, 2024, 3:53pm UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/2 "2024-10-23T15:53:48Z")

</div>

Hey, @LSeth👋 Based on my understating of the documentation, GraphQL doesn’t offer dynamic date generation inside the query itself. As you noted, you’ll need to convert the date into ISO8601 outside the query and then use it to get the result you are after.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![LSeth](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lseth/32/48165_2.png) [@LSeth](https://community.hubspot.com/u/LSeth)\
**Post date:** [October 30, 2024, 2:30pm UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/3 "2024-10-30T14:30:59Z")

</div>

Is there a way to get a variable from the page template that the Graphql file is attached to and use it in the Graphql file for the query?

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [November 14, 2024, 6:46am UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/4 "2024-11-14T06:46:40Z")

</div>

Hi @LSeth

As of now, there is no direct date filtering option available. What you can do here is you could generate the current date in your application code and pass it into the GraphQL query as a variable. This would allow you to always filter by a date newer than the current date.

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!

---

<div class="post-metadata">

**Author:** ![LSeth](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lseth/32/48165_2.png) [@LSeth](https://community.hubspot.com/u/LSeth)\
**Post date:** [November 25, 2024, 4:36pm UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/5 "2024-11-25T16:36:44Z")

</div>

[@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) thanks for the response. Do you know of a way to do the conversion outside the query? I am not sure if this would be done within the graphiql file itself or in the page template that has the graphiql file attached to it.

---

<div class="post-metadata">

**Author:** ![PTancredi](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@PTancredi](https://community.hubspot.com/u/PTancredi)\
**Post date:** [December 17, 2025, 5:54am UTC](https://community.hubspot.com/t/graphiql-filter-by-current-date/118932/6 "2025-12-17T05:54:59Z")

</div>

Actually I was able to do this succesfully by setting a variable in the graphql header file to today’s date as:

{{ dt\_local | unixtimestamp }}

then referencing it in the query:

```lia-code-sample
# $contact_id: "{{ request.query_dict.id }}"
# $today: "{{ dt_local | unixtimestamp }}"

query contact_payments($contact_id: String!, $today: Date) {
 CRM {
 contact(uniqueIdentifier: "id", uniqueIdentifierValue: $contact_id) {
 firstname
 lastname
 associations {
 deal_collection__contact_to_deal (
 filter: {hs_deal_stage_probability __gte: ".5", course_start_date__ gte: $today}
 limit: 3
 ) {...

```
