public function sample_2() { $jalaliDate = new JalaliDate(1394, 6, 12); $dateTime = $jalaliDate->toDateTime(); print "\n"; print $dateTime->format('Y-m-d'); print "\n"; }
public function test_to_DateTime() { $jDate = new JalaliDate(1394, 6, 1); $dateTime = $jDate->toDateTime(); $this->assertEquals('2015-08-23', $dateTime->format('Y-m-d')); }
public function test_convert_to_date_time_without_time_being_set() { $zone = date_default_timezone_get(); date_default_timezone_set('Asia/Tehran'); $jDate = new JalaliDate('1394', '9', '9'); $this->assertEquals('2015-11-30 00:00:00.000000 Asia/Tehran', $jDate->toDateTime()->format('Y-m-d H:i:s.u e')); $this->assertEquals('2015-11-30 00:00:00.000000 Asia/Tehran', DateConverter::jalaliToDateTime($jDate)->format('Y-m-d H:i:s.u e')); date_default_timezone_set($zone); }