Exemple #1
0
 /**
  * Converts a DateTime object to corresponding JalaliDate object.
  *
  * @param DateTime $dateTime
  *
  * @return JDateTime
  */
 public static function dateTimeToJDateTime(DateTime $dateTime)
 {
     $georgian = static::dateTimeToGeorgian($dateTime);
     $firstDay = new GeorgianDate(622, 3, 22);
     $jDate = JalaliDate::fromInteger($georgian->toInteger() - $firstDay->toInteger() + 1);
     return new JDateTime($jDate->getYear(), $jDate->getMonth(), $jDate->getDay(), $dateTime->format('H'), $dateTime->format('i'), $dateTime->format('s'));
 }
Exemple #2
0
 /**
  * Converts a DateTime object to corresponding JalaliDate object
  *
  * @param DateTime $dateTime
  * @return JalaliDate
  */
 public static function dateTimeToJalali(DateTime $dateTime)
 {
     $georgian = static::dateTimeToGeorgian($dateTime);
     $firstDay = new GeorgianDate(622, 3, 22);
     return JalaliDate::fromInteger($georgian->toInteger() - $firstDay->toInteger() + 1);
 }