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.

Custom Merge Tag: Date as yymmdd

  1. Any suggestions on how to build a custom merge tag for this?

    "yymmdd" is the most versatile save format.

    Posted 11 years ago on Tuesday February 26, 2013 | Permalink
  2. How are you capturing your data, and how would you use this merge tag?

    There is a gform_merge_tag_filter which may help, but right now I'm not sure what you need to do to know if this is going to work for you or not.
    http://www.gravityhelp.com/documentation/page/Gform_merge_tag_filter

    Posted 11 years ago on Tuesday February 26, 2013 | Permalink
  3. I'm using Gravity Forms on a form to capture a hidden date field (current date). Inside the default value I would like to put a merge tag. I want the output to be yymmdd.

    This is because it's getting passed to a custom post type's, custom field. I used Advanced Custom Fields for this.

    The default save format of ACF is yymmdd, and I would like to keep it in the database that way as well.

    Sorry I'm a bit of a novice. I know this can be accomplished relatively easily, probably a hook or something right?

    Posted 11 years ago on Tuesday February 26, 2013 | Permalink
  4. add_action("gform_pre_submission_7", "pre_submission_handler");
    function pre_submission_handler($form){
    	$date1 = $_POST["input_3"];
    	$date1 = str_replace('/', '-', $date1);
    	$date1 = date("Ymd", strtotime($date1));
    	$date2 = $_POST["input_5"];
    	$date2 = date("Ymd", strtotime($date2));
    	$_POST["input_3"] = $date1;
    	$_POST["input_5"] = $date2;
    }

    Got it.

    Posted 11 years ago on Tuesday February 26, 2013 | Permalink
  5. Thank you for the update.

    Posted 11 years ago on Wednesday February 27, 2013 | Permalink

This topic has been resolved and has been closed to new replies.