Esküvő

PHP Date Difference

PHP

This script calculates the days between two given dates.

<?php
function timeDiff($firstTime,$lastTime) {
	// convert to unix timestamps
	$firstTime = strtotime($firstTime);
	$lastTime = strtotime($lastTime);
	// perform subtraction to get the difference (in seconds) between times
	$timeDiff = ( $lastTime - $firstTime );
	// return the difference
	return $timeDiff;
}

// two dates
$date = strtotime("2012-01-01");
$date2 = strtotime("2012-02-01");

// get the difference
$diff = $timeDiff=($date2-$date)/60/60/24;

// echo difference
echo $diff;
?>


Esküvő


Related articles

Redirect www to non www with .htaccess RewriteRule

Redirect www to non www with .htaccess RewriteRule

05/12/2015

Redirect your websites visitors from www.domain.com to domain.com without www.

Email Validation

Email Validation

08/02/2013

Learn how to validate email on client side with HTML5, Javascript and on server side with PHP.

Generate Thumbnail on the Fly with PHP

Generate Thumbnail on the Fly with PHP

04/02/2013

In a previous artice I already showed you how to generate square thumbnails with PHP. Now I show you how to keep the original ratio of the image and how to control the alignment of the square image.


Leave a comment

We welcome any comment from you! Please keep in mind that comments are moderated and rel='nofollow' is in use. So, please do not use a domain as your name or a spammy keyword, or your comment will be deleted.

Name: *

E-mail: *

Message: *

Click on the flower *


Find us on Facebook

Tags

Esküvő

Back to Top