Calculate and output the Javanese Weton from regular date. This package can handle conversions from January 1, 1900 onwards
You may use composer to install javanese-weton into your project:
composer require irsyadulibad/weton
First, you need pass a DateTime to convert it into weton:
$date = new DateTime('2022-04-15');
$weton = new Weton($date);
Or, you can use static style instead
$date = new DateTime('2022-04-15');
$weton = Weton::from($date);
- Get weton's day an it's neptu value
// Weton's day name | ex: Friday
$weton->day->name;
// Weton's day neptu | ex: 6
$weton->day->neptu;
// Both day and neptu as object
// ex: name => Friday, neptu => 6
$weton->day;
- Get weton's pasaran and it's neptu value
// Weton's pasaran name | ex: Kliwon
$weton->pasaran->name;
// Weton's pasaran neptu | ex: 8
$weton->pasaran->neptu;
// Both day and neptu as object
// ex: name => Kliwon, neptu => 8
$weton->pasaran;
- Get total neptu
$weton->totalNeptu;
- Format to indonesian
You can change output to indonesian format usingtoIndonesian()
method
$weton->toIndonesian();
- Output as string
You can directly output the object as string, it will return pasaran and day name
// ex: Legi Friday
echo $weton;
// if indonesian, it will be `Jum'at Legi`
echo $weton->toIndonesian();
Github: [https://github.com/irsyadulibad]
Website: [http://irsyadulibad.my.id]
Facebook: [https://facebook.com/irsyadulibad.dev]