How to calculate speed

In a project, I plan to have MPH and/or KPH displayed on the screen to show how fast the player is going.

But how would I have that calculated to display on the screen?
How would the game know that your current speed is 20mph or 50 mph?

I'm not a big math guy, but I am sure if someone pointed out a simple formula for that, I could code it from there.
Any help appreciated. 🙂
Velocity = Displacement / Time

The term itself refers to "Miles Per Hour" or "Kilometer Per Hour".
So it is divided by time. How long does it take to move from A to B.
Velocity = Displacement / Time

The term itself refers to "Miles Per Hour" or "Kilometer Per Hour".
So it is divided by time. How long does it take to move from A to B.

Wow, super simple! Thanks for the reply!

So all I would really need would be a variable for time, a variable for where I was, where I am currently (displacement), figure out how much time has passed from one coordinate to the next, and then finally a variable for the end result (velocity). I'll have to try this out.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-calculate-speed.158178/