Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

    View All Products

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies

    How to build...

    • Client Portal
    • AI-Built Directory
    • Conference Website
    • WordPress CRM
    • Admin Dashboard
    • Inventory Management
    • Vendor Portal
    • Document Library
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityRevisions
    • GravitySearch
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GravityExport Lite
    • GF Zero Spam
    • GravityMigrate

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Agency accounts
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityRevisions
      • GravitySearch
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GravityExport Lite
      • GF Zero Spam
      • GravityMigrate
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
      • Agency accounts
    • Contact

    GravityMath

    • Add calculations to blog posts
    • Calculate the time between two dates with [gravitymath]
    • Calculating Survey fields totals based on their scoring
    • Calculations in GravityView
    • Can GravityMath be used inside a Gravity Forms form?
    • Can I use [gravitymath] with [gvlogic]?
    • Can I use [gravitymath] with Multiple Forms?
    • Debugging calculations in GravityMath
    • Developer Hooks for GravityMath
    • Does GravityMath support the Polls Add-on?
    • Does GravityMath support the Survey Add-on?
    • GravityMath Calculation field
    • How to add field calculations to the table footer
    • How to Calculate the Sum of a Field in Gravity Forms
    • How to display summaries using a block, widget, or shortcode
    • How to enable duration calculations in Gravity Forms with GravityMath
    • How to perform Gravity Forms time calculations in GravityView using GravityMath
    • Math filters: targeting a specific field value with [gravitymath]
    • Nested calculations in GravityMath
    • Pricing fields calculation
    • Sum GravityMath values for today, a custom date range, or a rolling window
    • The [gravitymath] shortcode
    • The {entry_count} merge tag in GravityMath
    • Using GravityMath inside a GravityView Custom Content field
    • When to use GravityMath and when to use GP Advanced Calculations
    • Home
    • Docs
    • GravityMath
    • Sum GravityMath values for today, a custom date range, or a rolling window

    Sum GravityMath values for today, a custom date range, or a rolling window

    Estimated reading: 7 minutes

    Updated on October 20, 2026

    The filter parameter of the [gravitymath] shortcode can compare each entry’s creation date with a date such as 2026-10-12 or a word such as -7 days, so a total covers only that period. The examples add up the Order total field (ID 1) of form 13. Replace 13 with your form’s ID and {Order total:1} with the merge tag of your field. The same filters work with scope="view" and scope="visible", and Math filters explains the rest of the filter syntax.

    How the date filter works #

    • filter_date_created holds the date, and op_date_created says how to compare it: gt keeps the entries created after it, and lt keeps the entries created before it. Neither keeps an entry created at that exact second.
    • GravityMath understands dates written as YYYY-MM-DD, a time after the date (2026-10-12 23:59:59), and words such as yesterday or -7 days. A date without a time means midnight.
    • Gravity Forms stores the date an entry was created in UTC, and the filter reads your date as UTC too. On a site in another time zone, see Use your site’s time zone.

    Because gt leaves out the exact second, the examples start at the last second of the day before (23:59:59), so an entry created at midnight is counted.

    Sum today’s entries #

    [gravitymath scope="form" id="13" filter="filter_date_created=yesterday 23:59:59&op_date_created=gt"]{Order total:1}[/gravitymath]

    This adds up the entries created after 23:59:59 yesterday, which are the entries created today.

    Sum entries between two dates #

    A range needs two conditions on the same date. When a key such as filter_date_created appears twice in filter, GravityMath uses only the last one. Write the second condition with your form’s ID and a colon before the field name, as in filter_13:date_created, and GravityMath applies both. This needs GravityMath 2.12.3 or later.

    [gravitymath scope="form" id="13" filter="filter_date_created=2026-10-12 23:59:59&op_date_created=gt&filter_13:date_created=2026-10-16&op_13:date_created=lt"]{Order total:1}[/gravitymath]

    This adds up the entries created on October 13, 14 and 15, 2026: after the last second of October 12 and before midnight at the start of October 16. Put your form’s ID in both filter_13:date_created and op_13:date_created. With scope="view", use the ID of the form the View is built on.

    Modifiers work over the range too: {Order total:1:avg} gives the average order total for those days, and {Order total:1:count} the number of orders.

    Sum a rolling window or a calendar period #

    Put one of these values in place of the filter value of the today example:

    Entries createdfilter value
    In the last 7 days, counted back from the current timefilter_date_created=-7 days&op_date_created=gt
    In the last 30 days, counted back from the current timefilter_date_created=-30 days&op_date_created=gt
    Today and the 6 days beforefilter_date_created=-7 days 23:59:59&op_date_created=gt
    This monthfilter_date_created=last day of last month 23:59:59&op_date_created=gt
    Last monthfilter_date_created=last day of -2 months 23:59:59&op_date_created=gt&filter_13:date_created=first day of this month 00:00&op_13:date_created=lt
    This yearfilter_date_created=last day of december last year 23:59:59&op_date_created=gt

    This shortcode adds up the last 7 days:

    [gravitymath scope="form" id="13" filter="filter_date_created=-7 days&op_date_created=gt"]{Order total:1}[/gravitymath]

    A word for a day, such as first day of this month, keeps the current time of day unless the value gives a time, so each calendar row in the table ends with 23:59:59 or 00:00.

    Use your site’s time zone #

    Words such as yesterday and the dates you type are read as UTC. On a site set to New York time, the UTC day begins at 8 p.m. New York time the evening before (7 p.m. in winter), so the total for today also counts that evening’s entries.

    To count from midnight in your time zone, add the time zone name after each date you type:

    [gravitymath scope="form" id="13" filter="filter_date_created=2026-10-12 23:59:59 America/New_York&op_date_created=gt&filter_13:date_created=2026-10-16 America/New_York&op_13:date_created=lt"]{Order total:1}[/gravitymath]

    For today, use the Gravity Forms merge tag {date_mdy}, which gives today’s date in the site’s time zone, followed by the time zone name and -1 second:

    [gravitymath scope="form" id="13" filter="filter_date_created={date_mdy} America/New_York -1 second&op_date_created=gt"]{Order total:1}[/gravitymath]
    • Use your site’s time zone. In WordPress, go to Settings, then General, and look at Timezone: the choice New York under America is written America/New_York.
    • A time zone after a word, as in today America/New_York, gives the wrong day for some hours of each day, because the date is taken from UTC before the time zone is applied. Use {date_mdy} for today.
    • For the entry date, use {date_mdy} and not {date_dmy}: GravityMath reads an entry date with slashes as month/day/year.
    • A UTC offset with a plus sign, such as +02:00, does not work, because the filter reads the plus sign as a space. Use the time zone name.
    • -7 days and -30 days count back from the current time, so they need no time zone.

    Filter by a Date field instead of the entry date #

    To total by a Date field in the form, such as a delivery date, use the field’s ID in place of date_created. A Date field holds a date without a time, so gt and lt compare whole days. This adds up the orders delivered on October 13, 14 and 15, with a Date field (ID 3) set to dd/mm/yyyy:

    [gravitymath scope="form" id="13" filter="filter_3=12/10/2026&op_3=gt&filter_13:3=16/10/2026&op_13:3=lt"]{Order total:1}[/gravitymath]

    Write the date in the field’s own format, as set in the form editor, or as YYYY-MM-DD. Words such as today don’t work on a Date field. For today’s date, use {date_mdy} when the field’s format starts with the month, and {date_dmy} for any other format:

    [gravitymath scope="form" id="13" filter="filter_3={date_dmy}"]{Order total:1}[/gravitymath]

    Troubleshooting #

    The total is 0, or the total of every entry

    GravityMath did not read the date. It reads an entry date with slashes as month/day/year, so 16/10/2026 is not a date, and 12/10/2026 means December 10. A date it cannot read becomes January 1, 1970: lt then matches no entry and gt matches every entry. Write dates as YYYY-MM-DD.

    The total prints nothing

    With scope="view" or scope="visible", a total whose filter matches no entry prints nothing, so a total for today stays empty until the first entry of the day. The same total with scope="form" prints 0. Adding notices="true" to the shortcode shows visitors an asterisk where the total would be, and the line “* Results may not be accurate.” at the end of the page content. The [gravitymath] shortcode describes notices and the filters that change its text.

    A range total includes entries outside the range

    GravityMath skipped the second condition. Check that the number before the colon in filter_13:date_created is your form’s ID, and update GravityMath if it is older than 2.12.3. With debug="true" on the shortcode and ?nocache=1 added to the page’s address, the debug report names a filter it skipped.

    The total for today includes the evening before

    Your site is not set to UTC. The section Use your site’s time zone shows how to count from your own midnight.

    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous écrire dans votre langue maternelle si c’est plus facile pour vous—nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta más fácil; ¡nosotros nos encargamos de la traducción!
    Sie können uns in Ihrer Muttersprache schreiben, wenn das für Sie einfacher ist – wir kümmern uns um die Übersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is — wij zorgen voor de vertaling!
    Du kan skrive til oss på ditt morsmål hvis det er enklere for deg — vi tar oss av oversettelsen!
    Du kan skriva till oss på ditt modersmål om det är lättare för dig — vi tar hand om översättningen!
    Você pode nos escrever em seu idioma nativo se for mais fácil para você — nós cuidaremos da tradução!
    Puoi scriverci nella tua lingua madre se ti è più facile — penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Get better at Gravity Forms every Friday

      Was this page helpful?

      Table Of Contents
      • How the date filter works
      • Sum today’s entries
      • Sum entries between two dates
      • Sum a rolling window or a calendar period
      • Use your site’s time zone
      • Filter by a Date field instead of the entry date
      • Troubleshooting
      GravityKit
      • How to Build It
      • GravityKit vs competitors
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Partner Directory
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Brand Kit
      • Privacy Policy
      • Terms of Service (“Terms”)
      I am a...
      • Nonprofit
      • Web agency
      • Small business owner
      • Web developer
      • Educational institution
      • WordPress freelancer
      • Startup founder
      • One-person agency
      Get notified of updates.

      We’re constantly improving GravityKit. Fill out your email below and we’ll notify you anytime major updates drop.

      See past editions
      • Facebook
      • Twitter
      • Mastodon
      GravityKit is a Gravity Forms Certified Developer.

      Copyright © 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.