Skip to main content
added 247 characters in body
Source Link
Drupalizeme
  • 1.6k
  • 2
  • 12
  • 17

You can try the date() function:

$date = get_post_meta($post->ID, 'event_start_date', true);
$day = date('d', strtotime($date)); //01-31

Another way will be DateTime:

$date = get_post_meta($post->ID, 'event_start_date', true);
$date = DateTime::createFromFormat('Y-m-d', $date);
$day  = $date->format('d');

You can try the date() function:

$date = get_post_meta($post->ID, 'event_start_date', true);
$day = date('d', strtotime($date)); //01-31

You can try the date() function:

$date = get_post_meta($post->ID, 'event_start_date', true);
$day = date('d', strtotime($date)); //01-31

Another way will be DateTime:

$date = get_post_meta($post->ID, 'event_start_date', true);
$date = DateTime::createFromFormat('Y-m-d', $date);
$day  = $date->format('d');
Source Link
Drupalizeme
  • 1.6k
  • 2
  • 12
  • 17

You can try the date() function:

$date = get_post_meta($post->ID, 'event_start_date', true);
$day = date('d', strtotime($date)); //01-31