Skip to content

Instantly share code, notes, and snippets.

@rafaehlers
Last active April 29, 2020 06:35
Show Gist options
  • Save rafaehlers/4229869d1c701e6a2825535859873c6f to your computer and use it in GitHub Desktop.
Save rafaehlers/4229869d1c701e6a2825535859873c6f to your computer and use it in GitHub Desktop.
Output the timestamp of "now" for use in date comparison with [gvlogic]
<?php
add_filter( 'gform_replace_merge_tags', function ( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
$merge_tag = '{gv_now_timestamp}';
if ( strpos( $text, $merge_tag ) === false ) {
return $text;
}
$local_timestamp = GFCommon::get_local_timestamp( time() );
//$local_date = date_i18n( 'Y-m-d', $local_timestamp, true );
return str_replace( $merge_tag, $local_timestamp, $text );
}, 10, 7 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment