mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
#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:
parent
824726c3f5
commit
4c0227e105
@ -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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user