• Post Reply Bookmark Topic Watch Topic
  • New Topic

date  RSS feed

 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in unix script
say for today if i type:
date +%Y%m%d
year month day will return"
20030801
are there a way that will return:
20030731(yesterday)
or
20030701(1 month ago)?
thanks!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12156
256
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jackie
Are you running GNU Date (standard on Linux, many admistrators also install it on other versions of Unix). You can determine this by typing "<code>date --version</code>" at the command prompt. On my (Linux) system this responds with:

If so, then the following are all possible:
Regards, Andrew
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!