Esempio n. 1
0
 public function sample_6()
 {
     $jalaliDate = JalaliDate::fromFormat('Y/m/d', '1394/6/20');
     print "\n";
     print $jalaliDate->format('D، d M y');
     print "\n";
 }
Esempio n. 2
0
 protected function compare($value, $parameters)
 {
     if (!is_string($value)) {
         return false;
     }
     $format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d';
     $baseDate = count($parameters) ? JalaliDate::fromFormat($format, $parameters[0]) : JalaliDate::fromDateTime(new DateTime());
     try {
         return JalaliDate::fromFormat($format, $value)->toInteger() - $baseDate->toInteger();
     } catch (\Exception $e) {
         return false;
     }
 }
Esempio n. 3
0
 public function test_from_format()
 {
     $jDate = new JalaliDate(1394, 6, 1);
     $this->assertEquals($jDate, JalaliDate::fromFormat('Y/m/d', '1394/6/1'));
 }