Created
October 2, 2014 02:25
-
-
Save wayanjimmy/678569ba15f0565c25fd to your computer and use it in GitHub Desktop.
Class Pecah Tanggal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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