Difference between two Timestamps
Difference between two Timestamps
(OP)
Hello everyone,
using ksh I need to figure out how many days have passed between a timestamp and the current date of today.
Format of the timestamp is:
YYYYMMDD (e.G. 20200703)
Using
will give me the correct format for the current date and at first sight simply substracting both is working fine as long as both are within the same month ...
e.G.
Problem is obvious:
Any ideas how to solve this ?
Best Regards,
Thomas
using ksh I need to figure out how many days have passed between a timestamp and the current date of today.
Format of the timestamp is:
YYYYMMDD (e.G. 20200703)
Using
CODE
date +%Y%m%d
will give me the correct format for the current date and at first sight simply substracting both is working fine as long as both are within the same month ...
e.G.
CODE
20200716 - 20200703
Problem is obvious:
CODE
20200801 - 20200703
Any ideas how to solve this ?
Best Regards,
Thomas
RE: Difference between two Timestamps
Such math is usually done with Unix times :
CODE --> Ksh
Feherke.
feherke.github.io