51

My requirement is to get difference of 2 timestamps in hours.

As the date diff option is taking long for me to figure out I am trying to convert both dates in to YYYYMMDDHHMMSS format and find the number difference. So I need to get the current date and time in the same format.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
xGen
  • 643
  • 1
  • 7
  • 8

1 Answers1

76

I believe this is the command you need:

date '+%Y%m%d%H%M%S'
SparedWhisle
  • 3,588
  • 4
  • 22
  • 35