[ad_1]
Hi! Yes, you’ll likely need to use a custom shortcode to format it the way you want, something like this:
/** * Get Event Start Date in Custom Format * * Custom shortcode for Contact Form 7 - Dynamic Text Extension * * @see https://projectdmc.org/support/topic/get-dynamic-start-date-of-an-event/ * @see https://www.php.net/manual/en/datetimeimmutable.createfromformat.php * * @return string The event's start time formatted asd.m.Y H:ior an empty string on failure. */ function jumpinsteph_event_start_date() { // Call theCF7_get_custom_fieldfunction directly, returns date formatted asYYYY-MM-DD HH:mm:ss$start_date = wpcf7dtx_get_custom_field(array('key' => '_EventStartDate')); if ($start_date) { // Convert string to DateTime object $start_date = date_create_from_format('Y-m-d H:i:s', $start_date, new DateTimeZone(wp_timezone_string())); if ($start_date !== false) { // Return with desired format return $start_date->format('d.m.Y H:i'); } } return ''; // Return empty string on failure } add_shortcode('jumpinsteph_event_start_date', 'jumpinsteph_event_start_date');
And then in your form template, simply use [dynamic_text debutformation "jumpinsteph_event_start_date"]
Let me know if that works for you!
