Add date/time conversion related scripts
This commit is contained in:
parent
3465007ba6
commit
81776f724a
1
.config/scripts/bin/timestamp-discord
Symbolic link
1
.config/scripts/bin/timestamp-discord
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../date/timestamp-discord
|
1
.config/scripts/bin/timezones
Symbolic link
1
.config/scripts/bin/timezones
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../date/timezones
|
1
.config/scripts/bin/timezones-from
Symbolic link
1
.config/scripts/bin/timezones-from
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../date/timezones-from
|
12
.config/scripts/date/timestamp-discord
Executable file
12
.config/scripts/date/timestamp-discord
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
time="$1"
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
time="now"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unix="$(date -d "$time" +%s)"
|
||||||
|
wl-copy "<t:${unix}> <t:${unix}:R>"
|
||||||
|
|
||||||
|
echo "The discord timestamp for:"
|
||||||
|
date -d "@${unix}"
|
||||||
|
echo "is copied to the clipboard"
|
29
.config/scripts/date/timezones
Executable file
29
.config/scripts/date/timezones
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# List of time zones to iterate through
|
||||||
|
timezones=(
|
||||||
|
"UTC"
|
||||||
|
"America/Los_Angeles"
|
||||||
|
#"Europe/London"
|
||||||
|
"Europe/Stockholm"
|
||||||
|
)
|
||||||
|
sep="------------------------------------------------"
|
||||||
|
|
||||||
|
time="$1"
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
time="now"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $sep
|
||||||
|
echo "My Time:"
|
||||||
|
TZ="$(cat /etc/timezone)" date -d "@$(date -d "$time" +%s)"
|
||||||
|
echo $sep
|
||||||
|
|
||||||
|
# Loop through each time zone and calculate the new time
|
||||||
|
for tz in "${timezones[@]}"
|
||||||
|
do
|
||||||
|
echo "Timezone: $tz"
|
||||||
|
TZ="$tz" date -d "@$(date -d "$time" +%s)"
|
||||||
|
echo $sep
|
||||||
|
done
|
||||||
|
|
13
.config/scripts/date/timezones-from
Executable file
13
.config/scripts/date/timezones-from
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
time="$1"
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
time="now"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd . > /dev/null
|
||||||
|
cd /usr/share/zoneinfo/
|
||||||
|
tz="$(find | sed 's|^\./||' | fzf)"
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
unix="$(TZ="$tz" date -d "$time" +%s)"
|
||||||
|
date -d "@${unix}"
|
Loading…
Reference in New Issue
Block a user