Skip to content

Instantly share code, notes, and snippets.

@iNem0o
Created April 16, 2013 10:23
Show Gist options
  • Save iNem0o/5394875 to your computer and use it in GitHub Desktop.
Save iNem0o/5394875 to your computer and use it in GitHub Desktop.
<?php
class DateTimeDeluxe extends DateTime {
public function isFirst($daystring) {
return $this -> diff(new DateTime("first ".$daystring." of ".strtolower($this -> format("F")))) -> days === 0;
}
}
$newDate = new DateTimeDeluxe();
// premier lundi du mois ?
var_dump($newDate -> isFirst('monday'));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment