DateTimeFormatter
in package
implements
PdbDataFormatterInterface, ConfigurableInterface
uses
PdbDataFormatterTrait, UpdateTrait
Format any date time objects.
Register this like:
'formatters' => [
DateTimeInterface::class => DateTimeFormatter:class,
// OR, if you want to configure the format.
DateTimeInterface:class => new DateTimeFormatter('Y-m-d'),
// Alternatively...
DateTimeInterface::class => [ DateTimeFormatter::class => [
'format' => 'Y-m-d',
],
],
Table of Contents
Interfaces
- PdbDataFormatterInterface
- A formatter is much like a `PdbDataBinderInterface` instead these are registered globally rather than passed through as data objects.
- ConfigurableInterface
- This class is 'configurable' - it has an `update()` method that accepts iterables.
Properties
- $format : string
Methods
- __construct() : mixed
- format() : string
- Format a value before binding.
- getBindingQuery() : string
- update() : void
Properties
$format
public
string
$format
Methods
__construct()
public
__construct([string $format = 'Y-m-d H:i:s' ]) : mixed
Parameters
- $format : string = 'Y-m-d H:i:s'
format()
Format a value before binding.
public
format(DateTimeInterface $value) : string
Parameters
- $value : DateTimeInterface
Return values
stringgetBindingQuery()
public
getBindingQuery(Pdb $pdb, string $column) : string
Parameters
- $pdb : Pdb
- $column : string
Tags
Return values
stringupdate()
public
update(iterable<string|int, mixed> $config) : void
Parameters
- $config : iterable<string|int, mixed>