Ver 1.0
This commit is contained in:
parent
b6b87d5aed
commit
9c72a71585
3546 changed files with 18655 additions and 0 deletions
26
nixosVista/homeManager/eww/base/date_format.sh
Executable file
26
nixosVista/homeManager/eww/base/date_format.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Get the day of the week, day of the month, month, and year
|
||||
day_of_week=$(date +"%a")
|
||||
day_of_month=$(date +"%d")
|
||||
month=$(date +"%b")
|
||||
year=$(date +"%Y")
|
||||
|
||||
# Remove leading zero from the day of the month
|
||||
day_of_month=$(echo $day_of_month | sed 's/^0*//')
|
||||
|
||||
# Determine the ordinal suffix
|
||||
if [[ $day_of_month -ge 11 && $day_of_month -le 13 ]]; then
|
||||
suffix="th"
|
||||
else
|
||||
case $((day_of_month % 10)) in
|
||||
1) suffix="st" ;;
|
||||
2) suffix="nd" ;;
|
||||
3) suffix="rd" ;;
|
||||
*) suffix="th" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Output the formatted date
|
||||
echo "${day_of_month}${suffix} $month $year"
|
||||
Loading…
Add table
Add a link
Reference in a new issue