Question: how to calculate difference between two dates in linux?
Answer: Provide valid time string in A and B.
Use date -d to handle time strings.
Use date %s to convert time strings to seconds since 1970 (unix epoche)
Use bash parameter expansion to subtract seconds.
divide by seconds per day (86400=60*60*24) to get difference as days.
! DST is not taken into account ! See this answer at unix.