我想显示日期
页面home_model中的:
public function get_filmkategori($gambar = FALSE)
{
if ($gambar === FALSE)
{
$query = $this->db->get('film');
return $query->result_array();
}
$this->db->select('*');
$this->db->from('film');
$this->db->join('kategori', 'kategori.kd_kategori =
film.kd_kategori','left');
$this->db->join('jadwal', 'film.kd_film = jadwal.kd_film','left');
$query = $this->db->get();
return $query->row_array();
}
页面视图中的:
<?php
$query = $this->db->query("select * FROM jadwal");
foreach ($query->result() as $row) :?>
<strong><?php echo $row->tgl_tayang;?></strong>
<span>Nov</span>
</div>
<div class="col s1">
<strong><?php echo $row->tgl_berakhir;?></strong>
<span>Nov</span>
</div>
<?php endforeach;?>
我想在tgl_berakhir
之前显示数组范围tgl_tayang答案 0 :(得分:0)
您可以使用DatePeriod
举个简单的例子:
$begin = new Datetime('2017-02-01'); // <-- start date
$end = new Datetime('2017-02-10'); // <-- end date
$daterange = new Dateperiod($begin, new dateInterval('P1D'), $end);
foreach ($daterange as $date) {
echo $date->format("Y-m-d"). "<br>";
}