strftime() 공개 정적인 메소드

Format a local time/date according to locale settings built in strftime() function. e.g: $obj->strftime("%x %H", time()); $obj->strftime("%H", time(), false, false, 'America/New_York');
저자: Omid Pilevar
public static strftime ( $format, $stamp = false, $convert = null, $jalali = null, $timezone = null ) : string
$format string Acceps format string based on: php.net/date
$stamp int Unix Timestamp (Epoch Time)
$convert bool (Optional) forces convert action. pass null to use system default
$jalali bool (Optional) forces jalali conversion. pass null to use system default
$timezone string (Optional) forces a different timezone. pass null to use system default
리턴 string Formatted input
예제 #1
0
파일: jDate.php 프로젝트: sajjadrad/jalali
 public function format($str, $convert = true)
 {
     // convert alias string
     if (in_array($str, array_keys($this->formats))) {
         $str = $this->formats[$str];
     }
     // if valid unix timestamp...
     if ($this->time !== false) {
         return jDateTime::strftime($str, $this->time, $convert);
     } else {
         return false;
     }
 }
예제 #2
0
 public function test_create()
 {
     //        $date = new Date();
     //        echo $date->date("W");
     //        $date = new jDateTime(false, true, 'Asia/Tehran');
     //        echo $date->date("z  W",time());
     //        echo $date->date("Y m d",strtotime("next week"))."<br>";
     //        echo jdate("Y m d",strtotime("next week"))."<br>";
     //        echo $date->strftime("y m d","next week");
     //       echo $date->strftime("next week", time(),true, true, 'America/New_York');
     $this->load->library("date");
     $date1 = new jDateTime(false, true, 'Asia/Tehran');
     $date2 = new jDateTime(false);
     $date1->strftime("now");
     $date2->strftime("tomorrow");
     echo $date1->strftime("%s");
     var_dump($date1->date() == $date2->date());
     var_dump($date1 < $date2);
     var_dump($date1 > $date2);
 }