CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
Date Class Reference

## Public Member Functions
| __construct ($BeginDate, $EndDate=NULL, $Precision=NULL, $DebugLevel=0)
| Object constructor. More...
| Formatted ()
| Get date value suitable for display. More...
| PFormatted ($Format, $ReturnEndDate=FALSE)
| Get date in format specified like PHP date() format parameter. More...
| FormattedForSql ($ReturnEndDate=FALSE)
| Get begin date (or end date if requested) formatted for SQL DATETIME field. More...
| FormattedISO8601 ()
| Get begin time in ISO 8601 format. More...
| BeginDate ()
| Get normalized begin date, suitable for storing via SQL. More...
| EndDate ()
| Get normalized end date, suitable for storing via SQL. More...
| Precision ($NewPrecision=NULL)
| Get/set date precision (combination of self::PRE_ bit constants). More...
| SqlCondition ($FieldName, $EndFieldName=NULL, $Operator="=")
| Get SQL condition for records that match date. More...
| FormattedPrecision ($Precision=NULL)
| Get string containing printable version of precision flags. More...

## Public Attributes
const | PRE_BEGINYEAR = 1
const | PRE_BEGINMONTH = 2
const | PRE_BEGINDAY = 4
const | PRE_BEGINDECADE = 8
const | PRE_BEGINCENTURY = 16
const | PRE_ENDYEAR = 32
const | PRE_ENDMONTH = 64
const | PRE_ENDDAY = 128
const | PRE_ENDDECADE = 256
const | PRE_ENDCENTURY = 512
const | PRE_INFERRED = 1024
const | PRE_COPYRIGHT = 2048
const | PRE_CONTINUOUS = 4096

## Detailed Description

Definition at line 18 of file Date.php.

## Constructor & Destructor Documentation

Date::__construct | ( |  | $BeginDate,
|  |  | $EndDate = `NULL`,
|  |  | $Precision = `NULL`,
|  |  | $DebugLevel = `0`
| ) |  |

Object constructor.

Parameters

  string | $BeginDate | Date (or beginning date, if range).
  string | $EndDate | Ending date (OPTIONAL, default to NULL).
  int | $Precision | Known precision of date (ORed combination of self::PRE_ constants). (OPTIONAL, defaults to NULL)
  int | $DebugLevel | Debugging output level.

Definition at line 44 of file Date.php.

References FormattedPrecision(), and Precision().

## Member Function Documentation

Date::BeginDate | ( |  | ) |

Get normalized begin date, suitable for storing via SQL.

Returns
  string Formatted date string, or NULL if no begin date is available.

Definition at line 523 of file Date.php.

References Precision().

Date::EndDate | ( |  | ) |

Get normalized end date, suitable for storing via SQL.

Returns
  string Formatted date string, or NULL if no end date is available.

Definition at line 560 of file Date.php.

References Precision().

Date::Formatted | ( |  | ) |

Get date value suitable for display.

Returns
  string Formatted date string.

Definition at line 375 of file Date.php.

References Precision().

Date::FormattedForSql | ( |  | $ReturnEndDate = `FALSE` | ) |

Get begin date (or end date if requested) formatted for SQL DATETIME field.

Parameters

  bool | $ReturnEndDate | If TRUE, return end date instead of begin. (OPTIONAL, defaults to FALSE)

Returns
  string Formatted date string.

Definition at line 480 of file Date.php.

References PFormatted().

Date::FormattedISO8601 | ( |  | ) |

Get begin time in ISO 8601 format.

Returns
  string Formatted date string.

Definition at line 489 of file Date.php.

References Precision().

Date::FormattedPrecision | ( |  | $Precision = `NULL` | ) |

Get string containing printable version of precision flags.

Parameters

  int | $Precision | Precision to use. (OPTIONAL, defaults to current precision value for date)

Returns
  string Printable precision string.

Definition at line 748 of file Date.php.

Referenced by __construct().

Here is the caller graph for this function:

Date::PFormatted | ( |  | $Format,
|  |  | $ReturnEndDate = `FALSE`
| ) |  |

Get date in format specified like PHP date() format parameter.

Parameters

  string | $Format | Format string.
  bool | $ReturnEndDate | If TRUE, return end date instead of begin. (OPTIONAL, defaults to FALSE)

Returns
  string Formatted date string.

Definition at line 457 of file Date.php.

References Precision().

Referenced by FormattedForSql().

Here is the caller graph for this function:

Date::Precision | ( |  | $NewPrecision = `NULL` | ) |

Get/set date precision (combination of self::PRE_ bit constants).

Parameters

  int | $NewPrecision | New precision value. (OPTIONAL)

Returns
  int Current precision value.

Definition at line 598 of file Date.php.

Referenced by __construct(), BeginDate(), EndDate(), Formatted(), FormattedISO8601(), PFormatted(), and SqlCondition().

Here is the caller graph for this function:

Date::SqlCondition | ( |  | $FieldName,
|  |  | $EndFieldName = `NULL`,
|  |  | $Operator = `"="`
| ) |  |

Get SQL condition for records that match date.

Parameters

  string | $FieldName | Database column name that contains date (or begin date, if range).
  string | $EndFieldName | Database column name that contains end date (for ranges). (OPTIONAL, defaults to NULL)
  string | $Operator | Comparison operator. (OPTIONAL, defaults to "=")

Returns
  string SQL condition.

Definition at line 613 of file Date.php.

References Precision().

## Member Data Documentation

const Date::PRE_BEGINCENTURY = 16

Definition at line 26 of file Date.php.

const Date::PRE_BEGINDAY = 4

Definition at line 24 of file Date.php.

Referenced by MetadataField\Drop(), and Date_Test\testInputFormats().

const Date::PRE_BEGINDECADE = 8

Definition at line 25 of file Date.php.

const Date::PRE_BEGINMONTH = 2

Definition at line 23 of file Date.php.

Referenced by MetadataField\Drop(), and Date_Test\testInputFormats().

const Date::PRE_BEGINYEAR = 1

Definition at line 22 of file Date.php.

Referenced by Date_Test\testInputFormats().

const Date::PRE_CONTINUOUS = 4096

Definition at line 34 of file Date.php.

const Date::PRE_COPYRIGHT = 2048

Definition at line 33 of file Date.php.

Referenced by Date_Test\testInputFormats().

const Date::PRE_ENDCENTURY = 512

Definition at line 31 of file Date.php.

const Date::PRE_ENDDAY = 128

Definition at line 29 of file Date.php.

const Date::PRE_ENDDECADE = 256

Definition at line 30 of file Date.php.

const Date::PRE_ENDMONTH = 64

Definition at line 28 of file Date.php.

const Date::PRE_ENDYEAR = 32

Definition at line 27 of file Date.php.

const Date::PRE_INFERRED = 1024

Definition at line 32 of file Date.php.

The documentation for this class was generated from the following file:

- lib/ScoutLib/Date.php