adding or subtracting days in the o/p of date | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

adding or subtracting days in the o/p of date

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-19-2008
St.Fartatric St.Fartatric is offline
Registered User
 
Join Date: May 2008
Last Activity: 30 May 2008, 3:09 AM EDT
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
adding or subtracting days in the o/p of date

how can we add or subtract days from the output of date command in unix...

like if i want to subtract a day from the result of date command like this..
v_date=`date +%Y%m%d`
this wud give me 20080519
now i want to subtract one day from this.. so tht it wud give me 20080518..

how do i do this??

also if i want to put a cond if its a thursday then sub 3 days from the date.. so tht it gives me monday's date..

how to do this???
Sponsored Links
    #2  
Old Unix and Linux 05-19-2008
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 31 March 2015, 6:06 AM EDT
Location: The Netherlands
Posts: 7,730
Thanks: 128
Thanked 544 Times in 512 Posts
A useful link:

http://www.unix.com/answers-frequent...rithmetic.html

Regards
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding days to system date then compare to a date kokoro Shell Programming and Scripting 1 01-25-2012 08:32 PM
Adding or subtracting days from current date in batch script anand1773 Windows & DOS: Issues & Discussions 2 01-12-2011 02:38 PM
Adding days to an input date. sud Shell Programming and Scripting 10 02-20-2009 07:30 PM
comparing files - adding/subtracting/formating columns oabdalla Shell Programming and Scripting 7 06-13-2008 03:20 AM
subtracting a days from current date rameshspal Shell Programming and Scripting 1 03-10-2006 12:18 AM



All times are GMT -4. The time now is 07:18 AM.