How to do i calculate number of days between two dates in terraform

I know its simple question, but i couldn’t able to find any docs related to this. all i could find is formatdate , timeadd functions.

Any help appreciated!!

start_datetime  = timestamp()
end_datetime  = timeadd(formatdate("YYYY-MM-01'T'00:00:00Z", timestamp()), "24h")

Looking for output which provide difference btw two dates in days.
diffindays = start_datetime - end_datetime

1 Like