#3340 - Add extra date functions

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@69974 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-01-12 02:02:45 +00:00
parent 824726c3f5
commit 4c0227e105

View File

@ -197,8 +197,28 @@ class Date extends DBField {
DB::requireField($this->tableName, $this->name, $values);
}
/**
* Returns true if date is in the past.
* @return boolean
*/
function InPast() {
return strtotime( $this->value ) < time();
return strtotime($this->value) < time();
}
/**
* Returns true if date is in the future.
* @return boolean
*/
function InFuture() {
return strtotime($this->value) > time();
}
/**
* Returns true if date is today.
* @return boolean
*/
function IsToday() {
return (date('Y-m-d', strtotime($this->value)) == date('Y-m-d', time()));
}
/**