# Show day of week in notification \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863>\
**Category:** Get Help\
**Tags:** dow, gform\_merge\_tag\_filter, date-field, conditional-notifications\
**Created:** [May 20, 2020, 7:50am UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863 "2020-05-20T07:50:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5cb718afeb919813](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@user5cb718afeb919813](https://community.gravityforms.com/u/user5cb718afeb919813)\
**Post date:** [May 20, 2020, 7:50am UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/1 "2020-05-20T07:50:55Z")

</div>

I’ve used a date-field in a form. In the conformation mail and notifications, I would like to display the day of week before the date, for example: Monday 19-05-2020. Is there a way to do this?

---

<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:** [May 21, 2020, 2:45am UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/2 "2020-05-21T02:45:01Z")

</div>

Hi Willem. You can do this with a small bit of code added to your theme functions.php file. Here’s the code:

```auto
add_filter( 'gform_merge_tag_filter', 'add_day_of_week', 10, 6 );
function add_day_of_week( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
  // if it's the all_fields merge tag, and field ID2, and the modifier is dow i.e. {all_fields:dow}
  if ( $merge_tag == 'all_fields' && $field->id == '2' && $modifier == 'dow' ) {
    // figure out the day from the date
    $timestamp = strtotime( $raw_value );
    $value = date( 'l', $timestamp ) . '&nbsp;' . $value;
  }
  // return the unmodified or modified value
  return $value;
}

```

Change the `field->id` from 2 to whatever your date field is.

Then, for the all\_fields merge tag in your notification, add the modifier `:dow` like this:

`{all_fields:dow}`

That will output the day of week, with a space, and then your formatted date. Let me know if you need any assistance with that.

---

<div class="post-metadata">

**Author:** ![user5cb718afeb919813](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@user5cb718afeb919813](https://community.gravityforms.com/u/user5cb718afeb919813)\
**Post date:** [May 25, 2020, 3:54pm UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/3 "2020-05-25T15:54:10Z")

</div>

Thanks for this excellent solution. It works!

But, the day of the week is displayed in English. I would like to translate this to Dutch. Could you tell me how to achieve this?

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![sha66y](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/sha66y/32/4173_2.png) [@sha66y](https://community.gravityforms.com/u/sha66y)\
**Post date:** [December 10, 2021, 9:08pm UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/4 "2021-12-10T21:08:32Z")

</div>

What if you have a specific field in a formatted notification (not using all fields, but inserting fields into a template I created)? I tried…

````auto
add_filter( 'gform_merge_tag_filter', 'add_day_of_week', 10, 6 );
function add_day_of_week( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
  // if it's the all_fields merge tag, and field ID2, and the modifier is dow i.e. {all_fields:dow}
  if ( $merge_tag == 'Date of Service' && $field->id == '4' && $modifier == 'dow' ) {
    // figure out the day from the date
    $timestamp = strtotime( $raw_value );
    $value = date( 'l', $timestamp ) . '&nbsp;' . $value;
  }
  // return the unmodified or modified value
  return $value;
}
``` and tried both {Date of Service:dow} and {Date of Service:4:dow} but can't get the day of week to show. Ideally it would format something like Saturday December 11, 2021.

Thanks
````

---

<div class="post-metadata">

**Author:** ![karlpotter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/karlpotter/32/3427_2.png) [@karlpotter](https://community.gravityforms.com/u/karlpotter)\
**Post date:** [December 10, 2021, 10:00pm UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/5 "2021-12-10T22:00:56Z")

</div>

That conditional wouldn’t work, I believe when filtering a field specific merge tag the $merge\_tag variable will not be the field’s label, it will be the field ID so the condition will never be met. If you’re using {Date of Service:4:dow} $merge\_tag will be 4, not “Date of Service”.

You’ll also likely get a better result if you just target all date fields that have the :dow modifier as well to use with other forms and date fields across your site without having to update the ID each time in the code.

```auto
add_filter( 'gform_merge_tag_filter', 'add_day_of_week', 10, 6 );
function add_day_of_week( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
    // if it's the all_fields merge tag, and field ID2, and the modifier is dow i.e. {all_fields:dow}
    if ( $field->type == 'date' && $modifier == 'dow' ) {
        // figure out the day from the date
        $timestamp = strtotime( $raw_value );
        $value = date( 'l F j, Y', $timestamp );
    }
    // return the unmodified or modified value
    return $value;
}

```

The above grabs any date field’s value where you’ve added the :dow modifier and converts it to the format you’re looking for.

Merge tags in use, using the same date field merge tag with and without the :dow modifier:

 ![Screen Shot on 2021-12-10 at 16-59-23](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/a/a05861e9819bece035ae8b8337baa6c97b04cb5c.png)

Merge tags after being replaced:

 ![Screen Shot on 2021-12-10 at 16-58-12](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/f9ff5ee787dfaea6097f6f53bc7417895aa99ed7.png)

---

<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:** [December 10, 2021, 10:41pm UTC](https://community.gravityforms.com/t/show-day-of-week-in-notification-resolved/4863/6 "2021-12-10T22:41:12Z")

</div>


