UnixTips.net

* use my tips at your own risk !!

* use my tips at your own risk !!

Categories

  • Other (3)
  • Scripting (10)
  • Unix (70)
  • Wordpress (2)

Powered by Genesis

Shell Script : Calculate Between Two Days

I tested this on LINUX

Use as you please.

# date
Mon May 18 16:16:29 EDT 2015
# date '+%s' -d "now"
1431980193
# date '+%s' -d "May 18 2014"
1400385600
# echo $(( (1431980193 - 1400385600) / 86400 )) 
365