Article View: alt.privacy.anon-server
Article #325474Re: [OT] Unix Time Stamp - Independence Day 2025 :-)
From: Stefan Claas
Date: Thu, 13 Jun 2024 19:26
Date: Thu, 13 Jun 2024 19:26
72 lines
2638 bytes
2638 bytes
Stefan Claas wrote:
> elvis-85792@notatla.org.uk wrote:
>
> > > $ echo -n '68686868' | hex2date
> > > Friday, 04. July 2025 23:48:56 +0000 (UTC)
> >
> > You've confused people looking for
> > 25th May
> > 15th August
> > or any other date.
>
> Oh, sorry Elvis! I thought that nowadays only
> a couple of Americans are using a.p.a-s ...
>
Anyways, here is a Bing AI generated bash script,
which allow to input Unix Epoch Time Stamps in hex
or decimal (-h -d Parameter), or it can be used as
a world clock, when giving no arguments.
#!/bin/bash
# Assume the time is in decimal format by default
time_format="decimal"
# Check if arguments were passed
while getopts ":d:h:" opt; do
case $opt in
d)
epoch_time=$OPTARG
;;
h)
epoch_time=$((16#$OPTARG))
time_format="hex"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Use the current time if no time was passed
if [ -z "$epoch_time" ]; then
epoch_time=$(date +%s)
fi
# Print the table header
printf "%-40s %s\n" "Timezone" "Local Time"
echo "---------------------------------------------------------------------"
# Write all available timezones to a file
timedatectl list-timezones > timezones.txt
# Output the local time for the passed Unix Epoch Time in each timezone
while IFS= read -r timezone
do
local_time=$(TZ=$timezone date -d "@$epoch_time" '+%a %b %d %Y %H:%M:%S %Z')
printf "%-40s %s\n" "$timezone" "$local_time"
done < timezones.txt
--
Regards
Stefan
Technical Details
Message-ID:
<v4fh5j$3t295$1@i2pn2.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf2.newsdeef.eu!not-for-mailReferences:
<v49l70$3lvsk$1@i2pn2.org> <slrnv6gs9o.8q8.elvis-85792@notatla.org.uk> <v49um7$3mbci$1@i2pn2.org>Show Full Headers
Complete Article Headers
Message-ID: <v4fh5j$3t295$1@i2pn2.org> Subject: Re: [OT] Unix Time Stamp - Independence Day 2025 :-) Date: Thu, 13 Jun 2024 21:26:42 +0200 From: Stefan Claas <pollux@tilde.club> References: <v49l70$3lvsk$1@i2pn2.org> <slrnv6gs9o.8q8.elvis-85792@notatla.org.uk> <v49um7$3mbci$1@i2pn2.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf2.newsdeef.eu!not-for-mail Newsgroups: alt.privacy.anon-server Organization: i2pn2 (i2pn.org) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Thu, 13 Jun 2024 19:26:43 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="4098341"; mail-complaints-to="usenet@i2pn2.org"; posting-account="uWi4uQdALkj7ETOfPbhNXfz0+Ra/gM5z6/Fa40dJi9U"; X-Spam-Checker-Version: SpamAssassin 4.0.0 Finger: tilde.club/~pollux/