How to measure the heartbeat using Piezo

I have a project which i have to use piezo, but as I know the piezo will provide with analog input, and analog read shows the strength of how hard you're pressing on the piezo element, and in order to get the heartbeat, we want to measure the time between two spikes (where the pressure on the piezo is higher), how could the Arduino possibly calculate the BPM if it doesn't factor in the time.

So how Can I possibly do this project??