Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Command

Status
Not open for further replies.

abovebrd

IS-IT--Management
May 9, 2000
690
US

If I use the following command : date +%j
it gives me the date output in "day of the year format" 004

date +%j (returns) 004 (If the date is 01/04/01_

Does any one a way to have the date command interpet a number and give the date

004 = 01/04/01
005 = 01/05/01
006 = 01/06/01 and so on



-Danny






 
"date +%j" actually gives you the julian date
and "date +%m/%d/%y" will return 01/05/01.
Now I wrote a quick script that does what you want, the syntax is kinda strange but it does get the result you were looking for.

#!/bin/ksh
JULIAN=`date +%j`
USUAL=`date +%m/%d/%y`
if [ $JULIAN != $USUAL ]; then
echo "$JULIAN = $USUAL"
else
echo "what's the date?"
fi
exit 0


hope it helps :)
d3funct
borg@pcgeek.net
The software required `Windows 95 or better', so I installed Linux.

 
wow, serious deja-vu ... i reckon i've seen this 3 times now ... i won't post the same answer :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top