Skip to content

Instantly share code, notes, and snippets.

@alrnz
Created July 17, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alrnz/592f0b89b78d8ff0f065ce4b70f180fd to your computer and use it in GitHub Desktop.
Save alrnz/592f0b89b78d8ff0f065ce4b70f180fd to your computer and use it in GitHub Desktop.
[Convert German Date to timestamp] Convert dates like 31.5.2019 to timestamp #PHP #Timestamp
private function strtotime_de($input = '20.5.2019'){
if ( preg_match('/^(?P<day>\d+)[\.-\/](?P<month>\d+)[\.-\/](?P<year>\d+)$/', $input, $matches) )
{
$timestamp = mktime(12, 0, 0, $matches['month'], $matches['day'], $matches['year']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment