>On Thu, 7 Nov 2013 16:02:43 -0500
>alex lupu <alup...@gmail.com> wrote:

> [snip]

> #!/bin/bash
> # hrs2date
> if [ "$1" == "" ]; then
>   # for people who didn't read my post
>   echo "Enter a date (yyyy-mm-dd)" ; exit 2
> fi
> 
> DATE=$1
> 
> NOWsecs=`date +%s`                   # This moment (in sec. since
> Jan. 1, 1970)
> DATEsecs=`date -d $DATE +%s`         # DATE's seconds since Jan. 1,
> 1970
> 
> toDATEsecs=$(( $NOWsecs - $DATEsecs ))
> toDATEhrs=$(( $toDATEsecs / 3600 ))                     # damn the
> minutes.
> 
> echo toDATEhrs = $toDATEhrs

This is actually very good. I'm gonna use this algorithm from now on. :)

-- 
You don't need an AI for a robot uprising.
Humans will do just fine.

Attachment: signature.asc
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to