This function allows you to determine the unformatted date value (in this format: YYYY-MM-DD HH:MM:SS) for dates of a type.
Parameter |
Type |
Description |
|---|---|---|
$dateFormat |
int |
Date format (possible values: 1 - 4) |
$date |
string |
Date in the stated format |
$includeTime |
bool |
Flag, if only date or date and time should be returned (optional); default value is false |
The function returns the date value in this format YYYY-MM-DD HH:MM:SS.
Example:
…
$dateFormat = 1;
$formattedDateWithoutTime = '10.09.2012';
$unformattedDate = $this->getUnformattedDate($dateFormat, $formattedDateWithoutTime);
// $unformattedDate == '2012-09-10'
$formattedDateWithTime = '10.09.2012 10:25:48';
$unformattedDate = $this->getUnformattedDate($dateFormat, $formattedDateWithTime, true);
// $unformattedDate == '2012-09-10 10:25:48'
…