Created
July 14, 2020 02:35
-
-
Save annahri/b28e2e2da21ea64fb5dc78273acb32b9 to your computer and use it in GitHub Desktop.
Menampilkan tanggal hari ini dalam penanggalan hijriyah.
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
#! /usr/bin/env bash | |
tanggal="$1" | |
tanggal="${tanggal:-$(date +'%Y-%m-%d')}" | |
hijri=$(python3 - <<CMD | |
from ummalqura.hijri_date import HijriDate | |
from datetime import date | |
print(HijriDate.get_hijri_date("$tanggal")) | |
CMD | |
) | |
tahun=`cut -d- -f1 <<<"$hijri"` | |
bulan=`cut -d- -f2 <<<"$hijri"` | |
hari=`cut -d- -f3 <<<"$hijri"` | |
declare -a hijriah=( | |
"Muharram" | |
"Safar" | |
"Rabi'ul Awwal" | |
"Rabi'ut Tsani" | |
"Jumadil Ula" | |
"Jumadil Akhir" | |
"Rajab" | |
"Sya'ban" | |
"Ramadhan" | |
"Syawwal" | |
"Dzulqa'dah" | |
"Dzulhijjah" | |
) | |
bulan="${hijriah[`echo "$bulan - 1" | bc`]}" | |
echo "$hari $bulan $tahun" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment