Adding Date/Time with PHP using Widgets

In this video tutorial we show you how to add the current date and time with PHP using the Easy Code Manager code block to widget feature.

Get Current Date – Sidebar – PHP
Main PHP script for your code block

<?php
function get_current_date() {
  $date_format = get_option('date_format');
  $time_format = get_option('time_format');
  $date = date("{$date_format} {$time_format}", current_time('timestamp'));
  return $date;
}

echo get_current_date();
?>