Datetime on time tag wordpress puts it outside the tag

General WordPress rule:

when a function starts with get, it will return the value. If it starts with the, it echoes the value.

Here, you need get_the_date('d-m-Y') instead of the_date('d-m-Y').