What date
chinou toure
Posted messages
18
Status
Member
-
jj -
jj -
Hello,
I would like a script that calculates the day of the month for a given date in UNIX command line (shell)
I would like a script that calculates the day of the month for a given date in UNIX command line (shell)
Configuration: Linux Firefox 3.0
2 answers
-
Hi,
See http://www.commentcamarche.net/forum/affich 3539696 difference between 2 dates aix ksh
--
JP - Penguin breeder -
Make a gesture for the environment, close your windows and adopt a penguin. -
Hello,
a little script like this:
# we retrieve the date as parameters of the script
day=$1
month=$2
year=$3
one=0
max_month=$[month-1]
# we retrieve the duration of the months before the date
for mc in $(seq 1 1 $max_month)
do
u=$(cal $mc $year | awk ' NF!=0 {toto=$(NF) } END{print toto}')
one=$[one+u]
done
unitary=$[one+day]
echo $unitary
a check is missing to avoid executing the loop if we are in January.