maskDatetime.php
Table of Contents
Functions
- maskDatetime() : string
- Replaces a value with a random date/time between two bounds, formatted.
Functions
maskDatetime()
Replaces a value with a random date/time between two bounds, formatted.
maskDatetime([mixed $value = null ][, string $begin = '1970-01-01T00:00:00.000' ][, string $end = '' ][, string $format = '' ]) : string
Implements the conventional datetime masker: a random instant is picked in
[begin, end] and rendered with format. The format uses DATE_FORMAT()-style
tokens — the common ones are supported: %yyyy, %yy,
%mm, %m, %dd, %d, %hh, %h, %ii, %i, %ss, %s, %fff and
%%. When format is empty (the default), an empty string is returned.
Parameters
- $value : mixed = null
-
The original value (ignored — replaced wholesale).
- $begin : string = '1970-01-01T00:00:00.000'
-
Earliest instant (ISO 8601). Defaults to the epoch.
- $end : string = ''
-
Latest instant (ISO 8601). Empty means "now".
- $format : string = ''
-
The DATE_FORMAT-style pattern. Empty returns "".