Merge branch 'marijn-settings' of ssh://gitlab-fnwi.uva.nl:1337/11166932/WebDB into marijn-settings
This commit is contained in:
12
website/queries/calcAge.php
Normal file
12
website/queries/calcAge.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* calculates the age of a user
|
||||
* @param string $bdayAsString
|
||||
* @return int age
|
||||
*/
|
||||
function getAge(string $bdayAsString) : int {
|
||||
$bday = new DateTime($bdayAsString);
|
||||
$today = new DateTime("now");
|
||||
$interval = $bday->diff($today);
|
||||
return $interval->y;
|
||||
}
|
||||
Reference in New Issue
Block a user