The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Date function
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 10-11-2008
danmero danmero is online now Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,427
You should read man date for your *NIX, this solution should work on Linux date (GNU coreutils) 5.97
Code:
dt=1/1/07                   # For January 1, 2007
# dt=$(date "+%d/%m%y")     # For current date
var=$(($(date -d $dt "+%s") / 86400))
echo $var
13514