try...
y=`date '+%y'`
j=`date '+%j'`
#DATE=`date '+%y%j'`
#echo $DATE
ystr=`expr $y - 1`
echo $ystr
if [ ${#ystr} -eq 1 ]
then
ystr=0$ystr
echo $ystr
fi
DATE=$ystr$j
echo $DATE
On Thu, 21 Mar 2002, Ball, Terry wrote:
> Environment: Oracle 8.1.6.3 on Solaris 5.8
>
> I am not a Unix
[EMAIL PROTECTED] Subject: Re: Sightly OT: Unix scripting
Terry,
I don't see a format like that in the unix date command formats,
unfortunately. You may have to test the value and pad the number yourself.
I have to do that in a number of my perl scripts.
You are lucky you have Unix...
Lisa Koivu
Oracle Database Monkey.
Fairfield Resorts, Inc.
954-
I'll show you one way to do it, if you quit calling that a Julian date. :)
( YYDDD is not a Julian date )
$> echo $DATE
2079
$> DATE=$(echo $DATE | awk '{ print substr(""$1,length(""$1)-4)
}')
$> echo $DATE
02079
Jared
"Ball, Terry" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED
(all examples are using /usr/bin/ksh shell)
You could do it this way:
DATE=$(date '+%y%j')
DATE=$((${DATE} - 1))
[ ${#DATE} -eq 4 ] && DATE="0${DATE}"
But you have bigger problems my friend. What happens if the date is 02001
and you subtract 1. The result is 02000 which is invalid. Since yo