PHP code example of irsyadulibad / weton

1. Go to this page and download the library: Download irsyadulibad/weton library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

irsyadulibad / weton example snippets


$date = new DateTime('2022-04-15');
$weton = new Weton($date);

$date = new DateTime('2022-04-15');
$weton = Weton::from($date);

// 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;

// 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;

$weton->totalNeptu;

$weton->toIndonesian();

// ex: Legi Friday
echo $weton;

// if indonesian, it will be `Jum'at Legi`
echo $weton->toIndonesian();