Display Current Time using shortcode

I am using the below code to display current time in php supported time zones:

<?php
date_default_timezone_set(‘Asia/Kolkata’);
$currentTime = date( ‘d-m-Y h:i:s A’, time () );
echo $currentTime;
?>

We need to create few different pages in wordpress to display current time in different supported cities / timezones in wordpress pages through shortcodes in following format:

[current_time timezone=”Africa/Accra”]

Please help us to write this function.

Read more here:: Display Current Time using shortcode

Leave a Reply

Your email address will not be published. Required fields are marked *