The State Change Detection example does the sensing and counting part.
If you don't need clock time and the time since power up is ok, you could use millis() to snag the time each time it goes high. You didn't say if you need to store the times.. You could store those times in an array perhaps, or just print to Serial? SD card perhaps?
For clock time, ie actual time-of-day, you'll need a Real Time Clock module or an internet connection to a time source.