Godot offers a number of time-oriented functions. To get an elapsed time, you really just need to get a delta between the start time and the current time. One core function you could us is
OS.get_unix_time(). With two such values, you can calculate an elapsed time using something like this:
var time_start = 0
var time_now = 0
time_start = OS.get_unix_time()
That'll store an initial start time. Then, at the point where you want to get an elapsed time, you just need to call that function again, and subtract the two values for a delta-time. The result will be the elapsed seconds between the two values. For example:
time_now = OS.get_unix_time()
var time_elapsed = time_now - time_start
Note, in the example, the elapsed time is calculated each frame in
_process. That'd be useful if you want some visual, running elapsed timer as it'd constantly update. If you really just need to calculate the time and display it at some specific point in time (say, when the game ends), you don't need to capture the current time in each frame. You can instead just grab that second value whenever you need it (at game end, for example).
Again, the result is in elapsed seconds, which you could convert to any display format you want...