diff options
| author | Mark Newnham <mark@newnhams.com> | 2016-04-14 17:26:50 -0600 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2016-04-27 19:46:25 +0200 |
| commit | 1212f9d410a63977246f00bbec68f33b2ff05e74 (patch) | |
| tree | 4e928c456970824d3773854ccaeeed014639b6fd /adodb.inc.php | |
| parent | a4c04ed9002842ce430ccff9bc9bcc402524da32 (diff) | |
| download | adodb-1212f9d410a63977246f00bbec68f33b2ff05e74.tar.gz adodb-1212f9d410a63977246f00bbec68f33b2ff05e74.tar.bz2 adodb-1212f9d410a63977246f00bbec68f33b2ff05e74.zip | |
New helper methods: day(), month(), year()
These new methods provide a simple shortcut to a timestamp field
formatted with the following values:
- Day as zero padded 2 digit number
- Month as zero padded 2 digit number
- Year as 4 digit number
The methods are documented in the ADOdb reference manual.
The sqlite version of these methods avoids the DST issue with sqlDate() by
directly calling the native date functions instead of adodb_date().
Fixes #225
Diffstat (limited to 'adodb.inc.php')
| -rw-r--r-- | adodb.inc.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/adodb.inc.php b/adodb.inc.php index 7199cbb4..8df910ca 100644 --- a/adodb.inc.php +++ b/adodb.inc.php @@ -3125,6 +3125,43 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 return $text; } + /* + * Formats the date into Month only format MM with leading zeroes + * + * @param string $fld The name of the date to format + * + * @return string The SQL text + */ + function month($fld) { + $x = $this->sqlDate('m',$fld); + + return $x; + } + + /* + * Formats the date into Day only format DD with leading zeroes + * + * @param string $fld The name of the date to format + * @return string The SQL text + */ + function day($fld) { + $x = $this->sqlDate('d',$fld); + return $x; + } + + /* + * Formats the date into year only format YYYY + * + * @param string $fld The name of the date to format + * + * @return string The SQL text + */ + function year($fld) { + $x = $this->sqlDate('Y',$fld); + return $x; + } + + } // end class ADOConnection |
