Unreliable entry dates [RESOLVED]

If I export the entries (to CSV) between 01-01-2023 and 01-09-2023 on form ID 1, the spreadsheet shows one entry on the date July 17, 2023.

But, if I view the database in PHPMyAdmin I can see there are actually two entries on that date on form ID 1.

id form_id date_created date_updated status
2347 1 2023-07-17 15:05:55 2023-07-17 15:05:55 active
2348 1 2023-07-17 22:06:58 2023-07-17 22:06:58 active

These are two different entries yet the exported CSV only includes one entry for the date 17/07/2023 23:05.

Comparing these IDs when I manually browse the entries in the Gravity Forms interface I see:

Entry Id Entry date
2347 July 17, 2023 at 11:05 pm
2348 July 18, 2023 at 6:06 am

So the problem is, basically the database says there are two entries for 2023-07-17 (IDs 2347 and 2348), but the the Gravity Forms ‘Entries’ interface and the exported CSV both insist the entries with those IDs are on different dates (July 17 and July 18).

I’m seeing this same behaviour on other forms (on both development and staging environments) with wildly different results in some cases.

Is this a bug?

Why am I asking?

I’m building a Gravity Forms add-on using GFAPI::get_entries( ) that will let you return entries for your chosen form within your specified date ranges, but it isn’t returning what I expected because I was comparing my output to what the exported CSV was telling me. Technically speaking, my output actually IS accurate based on what’s in the database.

This is not a bug. The entry created and updated dates in the database use UTC, while the dates in the CSV export have been modified to align with the timezone set in the site’s WordPress settings.

The GFAPI also returns the entries using UTC dates. You can use the following to adjust them to the site timezone.

$date = GFCommon::format_date( $date, false, 'Y/m/d' )
1 Like

Props for that. I wasn’t aware the dates were stored UTC. I’ve modified my code to account for it and now I’m getting the expected results (the results returned are matching what’s in the CSV).


1 Like