Pull Time and date into Zapier

Hi Amazing Community,
I can’t seem to pull the date right into Zapier. I would like to pull normal am/pm configuration vs military time followed by a date.

How would I do that?

Have you added gravity forms time field to your form?

Hi Gera. So long as you have a date field in the form, you can use the gform_zapier_field_value filter to translate that date to anything you like:

Example 4 shows manipulating a date field.

This is really helpful. How do you add AM/PM time values to this formula?

You can use any of the PHP date formats from here:

https://www.php.net/manual/en/datetime.format.php

To get just the time, it would look like this:

// assuming the date is in field 11
$timestamp = strtotime ( $entry['11'] );
// h:i A would give you 12:42 PM for example
$value = date ( 'h:i A', $timestamp );
return $value;

What does your desired date/time string look like? Would it be something like

2020-07-29 12:45 PM

If so, this would do it:

$value = date ( 'Y-m-d h:i A', $timestamp );

Hi Chris,

Is it possible to translate the entry date? Zapier uses it to create a start time/date for a service request in Trello, but Zapier’s field formatter struggles with date/time, it seems. Our form doesn’t have a date field in it for this purpose (service request time).

Hi @Verifyi9 - take a look at example 3 here:

That can be used to replace a field’s default value with a value from the entry meta (like date_created)

So, you can add a hidden field to the form, give it a default value of date_created, then use that code (modified to use your field ID) to send the entry date.

If you need to modify the date format, once you have it, you can then apply the method above using PHP time/date functions to the $value. If you need more help with the actual code, let me know.

Hi Chris,

Not a coder but usually I can follow instructions! But I have been unable to make this work.

The problem: I send the entry date to Zapier; however, GF sends it as UTC in the format “2020-08-15 19:17:24.” I want to display it as “08-15-2020 15:17:24” in the correct timezone.

What I tried:

  1. Created a hidden text field with date_created as the default value (also tried {date_created});

  2. Added example #3 (unedited) as you suggested to functions.php;

(My guess is that I need to edit this snippet, but not sure how.)

  1. Added the following to functions.php:

    $timestamp = strtotime ( $entry[‘27’] );
    $value = date ( ‘m-d-Y h:i A’, $timestamp );
    return $value;

‘27’ is the field ID

On submission, GF sends “date_created” to Zapier.

Thanks in advance for your help!

I think you need to go into your Wordpress settings and change the default date format to send the way you want.