PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Is there a merge tag for time?

  1. My client is wanting to receive an notification email with the following in the body:

    First Last

    Entry URL

    Date AND TIME Submitted

    So far the only one I can't find is time. Is there a "secret" code for that?

    Posted 12 years ago on Wednesday May 9, 2012 | Permalink
  2. David Peralty

    There doesn't seem to be a merge tag for time. Will you want to save the time submitted to the entry page as well, or is just having it in the notification e-mail good enough?

    Posted 12 years ago on Wednesday May 9, 2012 | Permalink
  3. We see that the time and date is displayed on the actual entry form in the info box on the top right of the page, so that's good enough on that end, we just need to be able to have it in the email.

    I understand that the email is generated as soon as the form is submitted and we can go by the actual email time stamp, but my client has a strict 24-hour turnaround time to get back to anyone submitting to this form, so having it in the actual body of the notification email is pretty critical.

    Posted 12 years ago on Wednesday May 9, 2012 | Permalink
  4. David Peralty

    So, I just mocked up a quick thing that you may need to customize based on server settings, but here we go.

    First, I went into my functions.php file for my theme and added the following:

    function timedisplay( $atts ){
     $timesubmitted = date('H:i:s T');
     return $timesubmitted;
    }
    add_shortcode( 'timesubmit', 'timedisplay' );

    This created a shortcode. I then added the following to my notifications:

    [timesubmit]

    Then when I submitted my form, the time came through. Of course for me it came through as UTC, which because of where I live is 4 hours before GMT. This is probably because my server isn't set to Eastern time which is fine for me, but you may need to customize it to show the time in your time zone.

    Posted 12 years ago on Wednesday May 9, 2012 | Permalink