//$tsDay timestamp
//Jour au format long
function getDayOfTheWeek($tsDay) {
$days = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
return $days[date("w", $tsDay)];
}
//Jour au format court
function getDayOfTheWeekShort($tsDay) {
$days = array("Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam");
return $days[date("w", $tsDay)];
}
PHP date
<iframe width="100%" height="416" src="http://sykius.fr/snippetvamp/snippetvamp.php?embed=521f534d62a6b" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 29/08/2013
function onlyDigits($string) {
return preg_replace("#[^0-9]#", "", $string);
}
PHP
<iframe width="100%" height="236" src="http://sykius.fr/snippetvamp/snippetvamp.php?embed=521e09312f006" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 28/08/2013
function getExt($file) {
return pathinfo($file, PATHINFO_EXTENSION);
}
PHP
<iframe width="100%" height="236" src="http://sykius.fr/snippetvamp/snippetvamp.php?embed=521dc1a973cf9" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 28/08/2013
//Javascript
function addZ(n) {
return (n<10)?"0"+n:n;
}
//PHP
function addZ($n) {
return ($n<10)?"0".$n:$n;
}
Javascript PHP
<iframe width="100%" height="344" src="http://sykius.fr/snippetvamp/snippetvamp.php?embed=521da4168d169" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 28/08/2013
function nbJourEntreDate($date1, $date2) {
$datetime1 = new DateTime(date("Y-m-d", $date1));
$datetime2 = new DateTime(date("Y-m-d", $date2));
$interval = $datetime1->diff($datetime2);
return $interval->format('%a');
}
PHP date
<iframe width="100%" height="290" src="http://sykius.fr/snippetvamp/snippetvamp.php?embed=5215cf0479f97" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 22/08/2013