# profile-builder/4.0.1/admin/advanced-settings/includes/shortcodes/format-date.php

User Profile Builder – Beautiful User Registration Forms, User Profiles &amp; User Role Editor, version 4.0.1. 40 lines.

- Page: https://pluginprobe.com/plugins/profile-builder/4.0.1/code/admin/advanced-settings/includes/shortcodes/format-date.php
- Raw: https://pluginprobe.com/plugins/profile-builder/4.0.1/raw/admin/advanced-settings/includes/shortcodes/format-date.php
- Modified: 2026-08-26T08:26:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/profile-builder/4.0.1/code/admin/advanced-settings/includes/shortcodes/format-date.php#L10-L20`.

```php
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

add_shortcode( 'wppb-format-date', 'wppb_toolbox_format_date_handler' );
function wppb_toolbox_format_date_handler( $atts ){
	$a = shortcode_atts( array(
		   'date' => null,
		   'format' => null,
	),$atts );

	if ($a['date'] === null)
		return;

	if ($a['format'] === null)
		return esc_html( $a['date'] );

	$format = wppb_toolbox_sanitize_date_format( $a['format'] );

	if ( $format === '' )
		return esc_html( $a['date'] );

	$date = strtotime($a['date']);

	return esc_html( date( $format, $date ) );
}

/**
 * Keep letters, digits, and date separators; drop markup and other symbols.
 *
 * @param string $format User-supplied date format.
 * @return string
 */
function wppb_toolbox_sanitize_date_format( $format ) {
	if ( ! is_string( $format ) )
		return '';

	return preg_replace( '/[^\p{L}0-9 \-\/.,:\\\\()]/u', '', $format );
}

```
