# Unreliable entry dates \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917>\
**Category:** Get Help\
**Tags:** entry-date, utc, date, date\_created, gfcommon::format\_date\
**Created:** [September 23, 2023, 8:51am UTC](https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917 "2023-09-23T08:51:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stormbox](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/stormbox/32/6636_2.png) [@Stormbox](https://community.gravityforms.com/u/Stormbox)\
**Post date:** [September 23, 2023, 8:51am UTC](https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917/1 "2023-09-23T08:51:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [September 24, 2023, 10:26am UTC](https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917/2 "2023-09-24T10:26:30Z")

</div>

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.

```auto
$date = GFCommon::format_date( $date, false, 'Y/m/d' )

```

---

<div class="post-metadata">

**Author:** ![Stormbox](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/stormbox/32/6636_2.png) [@Stormbox](https://community.gravityforms.com/u/Stormbox)\
**Post date:** [September 24, 2023, 1:52pm UTC](https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917/3 "2023-09-24T13:52:48Z")

</div>

> [@richardw8k](#):
>
> `GFCommon::format_date`

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).

Cheers!

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [September 25, 2023, 1:39pm UTC](https://community.gravityforms.com/t/unreliable-entry-dates-resolved/15917/4 "2023-09-25T13:39:40Z")

</div>


