Menu

## Format

Format.php : 22

Formatter methods for the DataTables Editor

All methods in this class are static with common inputs and returns.

### Table of Contents

DATE_EPOCH = "U"
  Date format: 1331251200. jQuery UI equivalent format: @
DATE_ISO_1036 = "D, j M y"
  Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y
DATE_ISO_1123 = "D, j M Y"
  Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy
DATE_ISO_2822 = "D, j M Y"
  Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy
DATE_ISO_822 = "D, j M y"
  Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y
DATE_ISO_850 = "l, d-M-y"
  Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y
DATE_ISO_8601 = "Y-m-d"
  Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd
DATE_TIMESTAMP = "U"
  Date format: 1331251200. jQuery UI equivalent format: @
DATE_USA = "m-d-Y"
  Date format: March-. jQuery UI equivalent format: D, d M yy
dateFormatToSql() : mixed
  Convert from a format given by the options parameter to a format that SQL servers will recognise as a date.
dateSqlToFormat() : mixed
  Convert from SQL date / date time format to a format given by the options parameter.
datetime() : mixed
  Convert from one date time format to another
explode() : mixed
  Convert a string of values into an array for use with checkboxes.
fromDecimalChar() : mixed
  Convert a number from using any character other than a period (dot) to one which does use a period. This is useful for allowing numeric user input in regions where a comma is used as the decimal character. Use with a set formatter.
ifEmpty() : mixed
  Formatter that can be used to specify what value should be used if an empty value is submitted by the client-side (e.g. null, 0, 'Not set', etc)
implode() : mixed
  Convert an array of values from a checkbox into a string which can be used to store in a text field in a database.
nullEmpty() : mixed
  Convert an empty string to `null`. Null values are very useful in databases, but HTTP variables have no way of representing `null` as a value, often leading to an empty string and null overlapping. This method will check the value to operate on and return null if it is empty.
toDecimalChar() : mixed
  Convert a number with a period (dot) as the decimal character to use a different character (typically a comma). Use with a get formatter.

### Constants

#### DATE_EPOCH

Format.php : 48

Date format: 1331251200. jQuery UI equivalent format: @

`public mixed DATE_EPOCH = "U"`

#### DATE_ISO_1036

Format.php : 33

Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

`public mixed DATE_ISO_1036 = "D, j M y"`

#### DATE_ISO_1123

Format.php : 36

Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

`public mixed DATE_ISO_1123 = "D, j M Y"`

#### DATE_ISO_2822

Format.php : 39

Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

`public mixed DATE_ISO_2822 = "D, j M Y"`

#### DATE_ISO_822

Format.php : 27

Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

`public mixed DATE_ISO_822 = "D, j M y"`

#### DATE_ISO_850

Format.php : 30

Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y

`public mixed DATE_ISO_850 = "l, d-M-y"`

#### DATE_ISO_8601

Format.php : 24

Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd

`public mixed DATE_ISO_8601 = "Y-m-d"`

#### DATE_TIMESTAMP

Format.php : 45

Date format: 1331251200. jQuery UI equivalent format: @

`public mixed DATE_TIMESTAMP = "U"`

#### DATE_USA

Format.php : 42

Date format: March-. jQuery UI equivalent format: D, d M yy

`public mixed DATE_USA = "m-d-Y"`

### Methods

#### dateFormatToSql()

Format.php : 94

Convert from a format given by the options parameter to a format that SQL servers will recognise as a date.

`public static dateFormatToSql(mixed $format) : mixed`

Typical use of this method is to use it with the Field::getFormatter() and Field::setFormatter() methods of Field where the parameters required for this method will be automatically satisfied.

##### Parameters

$format : mixed

##### Return values

mixed —

#### dateSqlToFormat()

Format.php : 64

Convert from SQL date / date time format to a format given by the options parameter.

`public static dateSqlToFormat(mixed $format) : mixed`

Typical use of this method is to use it with the Field::getFormatter() and Field::setFormatter() methods of Field where the parameters required for this method will be automatically satisfied.

##### Parameters

$format : mixed

##### Return values

mixed —

#### datetime()

Format.php : 130

Convert from one date time format to another

`public static datetime(mixed $from, mixed $to) : mixed`

Typical use of this method is to use it with the Field::getFormatter() and Field::setFormatter() methods of Field where the parameters required for this method will be automatically satisfied.

##### Parameters

$from : mixed
$to : mixed

##### Return values

mixed —

#### explode()

Format.php : 158

Convert a string of values into an array for use with checkboxes.

`public static explode([mixed $char = '|' ]) : mixed`

@param string $val Value to convert to from a string to an array

##### Parameters

$char : mixed = '|'

##### Return values

mixed —

#### fromDecimalChar()

Format.php : 224

Convert a number from using any character other than a period (dot) to one which does use a period. This is useful for allowing numeric user input in regions where a comma is used as the decimal character. Use with a set formatter.

`public static fromDecimalChar([mixed $char = ',' ]) : mixed`

@param string $val Value to convert to from a string to an array

##### Parameters

$char : mixed = ','

##### Return values

mixed —

#### ifEmpty()

Format.php : 205

Formatter that can be used to specify what value should be used if an empty value is submitted by the client-side (e.g. null, 0, 'Not set', etc)

`public static ifEmpty(mixed $ret) : mixed`

@param string $val Value to convert to from a string to an array

##### Parameters

$ret : mixed

##### Return values

mixed —

#### implode()

Format.php : 173

Convert an array of values from a checkbox into a string which can be used to store in a text field in a database.

`public static implode([mixed $char = '|' ]) : mixed`

@param string $val Value to convert to from an array to a string

##### Parameters

$char : mixed = '|'

##### Return values

mixed —

#### nullEmpty()

Format.php : 190

Convert an empty string to `null`. Null values are very useful in databases, but HTTP variables have no way of representing `null` as a value, often leading to an empty string and null overlapping. This method will check the value to operate on and return null if it is empty.

`public static nullEmpty() : mixed`

@param string $val Value to convert to from a string to an array

##### Return values

mixed —

#### toDecimalChar()

Format.php : 239

Convert a number with a period (dot) as the decimal character to use a different character (typically a comma). Use with a get formatter.

`public static toDecimalChar([mixed $char = ',' ]) : mixed`

@param string $val Value to convert to from a string to an array

##### Parameters

$char : mixed = ','

##### Return values

mixed —

## Search results