Skip to content

Instantly share code, notes, and snippets.

@wayanjimmy
Created October 2, 2014 02:25
Show Gist options
  • Save wayanjimmy/678569ba15f0565c25fd to your computer and use it in GitHub Desktop.
Save wayanjimmy/678569ba15f0565c25fd to your computer and use it in GitHub Desktop.
Class Pecah Tanggal
<?php
/*
*Kelas memecah format tanggal YYYY-MM-DD
*digunakan untuk menghitung JDN sebuah tanggal untuk dapat menghitung selisih antar 2 tanggal
*@author : Jimboy
*/
class PecahTanggal{
private $pecah;
private $hari;
private $bulan;
private $tahun;
private $jdn;
function __construct($tanggal){
$this->pecah = explode("-", $tanggal);
$this->hari = $this->pecah[2];
$this->bulan = $this->pecah[1];
$this->tahun = $this->pecah[0];
$this->jdn = GregorianToJD($this->bulan, $this->hari, $this->tahun);
}
public function getHari(){
return $this->hari;
}
public function getBulan(){
return $this->bulan;
}
public function getTahun(){
return $this->tahun;
}
public function getJDN(){
return $this->jdn;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment