PHP code to make a dynamic countdown timer

PHP code to make a dynamic countdown timer

Here, we will figure out how to configuration/make a unique commencement time utilizing PHP code? Here, we are setting the last date time until commencement time will run.

Here and there, we have to declare something on the site or need to wish any celebration to our perusers then we need a sort of clock (we can say, it is commencement clock) to be shown on the site.

Right now, are composing PHP code that will show a commencement clock for “Diwali” on the site page.

Right now,

  • We are utilizing a function strtotime() which is utilized to falsely create the timestamp for a chose date and time.
  • We are characterizing date and time for celebration “Diwali“, which is known as deadline time, the value is “2017-10-19 12:00:00.”
  • What’s more, as a present date time we are utilizing now which gives current date and time.

PHP code (with HTML) to show commencement clock

<!doctype html>
<html>
	<head>
		<title>PHP Countdown Timer</title>
	</head>

	<body>
		<?php
			$diwali = strtotime("2017-10-19 12:00:00"); // or whenever the diwali is
			$current=strtotime('now');
			$diffference =($diwali-$current);
			$days=floor($diffference / (60*60*24));
			echo "$days days left on Diwali";
		?>
		</br>
		<?php 
		$image_url='http://happydiwali2016imageshd.in/wp-content/uploads/2017/09/Diwali-GIF-1.gif';
		?>
		<img src="<?php echo $image_url;?>">
	</body>
</html>

Output

PHP code to make a dynamic countdown timer

Recent Posts

error: Alert: Content is protected!!