How to time when a button is pressed

I’m making a fighter and i want my character to slide for a certain amount of time after I press a button. The button doesn’t necessarily have to be held down for it to work and I want it to stop after 1.5 seconds and go back to crouching. Any help? I have no idea how to code timers

You can use a float and Time.deltaTime in Update (counter += Time.deltaTime …), a coroutine or Invoke methods.