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

  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 Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 05-19-2008
Franklin52's Avatar
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 19 December 2014, 6:10 AM EST
Location: The Netherlands
Posts: 7,720
Thanks: 126
Thanked 538 Times in 508 Posts
A useful link:

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

Regards
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:32 PM
Adding or subtracting days from current date in batch script anand1773 Windows & DOS: Issues & Discussions 2 01-12-2011 03:38 PM
Adding days to an input date. sud Shell Programming and Scripting 10 02-20-2009 08:30 PM
comparing files - adding/subtracting/formating columns oabdalla Shell Programming and Scripting 7 06-13-2008 04:20 AM
subtracting a days from current date rameshspal Shell Programming and Scripting 1 03-10-2006 01:18 AM



All times are GMT -4. The time now is 10:19 AM.