You are here

public static function PersianDateConverter::normalizeDate in Persian Date for Drupal 8 8.4

Same name and namespace in other branches
  1. 8 src/Converter/PersianDateConverter.php \Drupal\persian_date\Converter\PersianDateConverter::normalizeDate()

Converts wrongly formatted shamsi datetime to standard one

Parameters

mixed $dateTime:

Return value

\DateTime

1 call to PersianDateConverter::normalizeDate()
PersianDateFormatter::format in src/Service/Formatter/PersianDateFormatter.php
Formats a date, using a date type or a custom date format string.

File

src/Converter/PersianDateConverter.php, line 97

Class

PersianDateConverter
This class converts Gregorian datetime to Persian datetime and reverse.

Namespace

Drupal\persian_date\Converter

Code

public static function normalizeDate($dateTime) {
  $return = PersianDateFactory::buildFromExactDate($dateTime
    ->format('H'), $dateTime
    ->format('i'), $dateTime
    ->format('s'), $dateTime
    ->format('m'), $dateTime
    ->format('d'), $dateTime
    ->format('Y'))
    ->getOriginalDateTime();
  return $return;
}