Register
It is currently Thu Jul 24, 2014 6:19 am

date function for last year


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Sat Mar 10, 2012 8:29 am   
User avatar

Joined: Sat Mar 10, 2012 8:24 am
Posts: 1
This should be an easy one but I can't find the answer. I am not a programmer but I need the date function for last year in Bash. I have the following:

THISMONTH=$(date +%B)
THISDAY=$(date +%d)
LASTMONTH=$(date -d "-1 month" +%B)
THISYEAR=$(date +%Y)
LASTYEAR= ???

Cheers,


Top
 Profile WWW  
 PostPosted: Sat Mar 10, 2012 9:44 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
hi,

you're not a programmer, but you've got man pages too.

LastYear is like LastMonth.


Top
 Profile  
 PostPosted: Sat Mar 10, 2012 5:00 pm   
User avatar

Joined: Fri Jul 22, 2011 5:39 pm
Posts: 46
date --date="365 days ago"


Top
 Profile WWW  
 PostPosted: Sat Mar 10, 2012 6:06 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
=D> =))


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP