This thread shows you how to create a dateTime object from a string
As per that thread, the easiest way to handle all this is, is to use time in milliseconds.
Get your contract-start date as a datetime, convert to epoch.
Get your contract-end date as a datetime, convert to epoch.
Get now, convert to epoch.
Now do whatever maths you like.
now - start = time so far
end - now = time to go
end - start = contract duration
(time so far / contract duration) * total km allowed = allowed to date