The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: how can i use mathematic calculate in date?
EV1L
Newbie
Rank: 1



UID 139
Digest Posts 0
Credits 0
Posts 28
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:37 AM  Profile | P.M. 
how can i use mathematic calculate in date?



how can i use mathematic calculate in date?



hi all,
all i need to do is
calculate the system date to my desire date.

my case is
everyday in my system , it will receive ftp file from another unix server.

if i issued 'date' for today it will return this :
-bash-3.00$ date +%y%m%d
20070605

but the ftp file that receive everyday is like this
birth_20070604.dat

see?
because this ftp file is less than today for 1 day.
i want to use this file to process to another job to execute this file .
so,i want to minus 1 day from system date that i got from 'date' function

btw,i use solaris 10
when i use date -d
it said somethings like
illegal option -d

thank you very much in advance


........................................................................................

sorry let me change my question
after i look backward through these forums
i found that they have some kind of this

date_stamp=`tz=cst+24 date +%y%m%d`
echo $date_stamp
20070604

so i can get a yesterday date already

but another problem is
a year format

i want to convert christian era to buddhist era
that means
if i want to convert by mathematic
i need to +543 from current christian era
eg. if want to change to buddhist era,i need to plus 543 to 2007
so, the buddhist era of this year is 2007+543 = 2550


last edited by guitaroa47 : 1 week ago at 05:21 am.


Top
Bubblemate
Newbie
Rank: 1



UID 79
Digest Posts 0
Credits 0
Posts 50
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:37 AM  Profile | P.M. 
code:
eval date_stamp=$(tz=cst+24 date +'$((%y+543))%m%d')
Top
 

 

All times are GMT, the time now is Mar 20, 2010 05:11 AM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.004746 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP