YES, to answer your question.
For a little more insight…
Metric threaded fasteners, use a format like M8x1.25mm to indicate that the screw/bolt (or hole that it fits) is 8 millimeters in diameter and has a thread “pitch” of 1.25 millimeters, meaning that each thread is 1.25mm apart from the adjacent threads.
What is left out of the M8x1.25 screw/bolt dimension is the length of the fastener. An M8x1.25x 25mm length would have 20 threads (count them!), from head to end (25mm divided by 1.25mm).
An M10x1.5 x 30mm (length) fastener would also have 20 threads. Although it is longer, the thread pitch is coarser (distance between threads is greater).
Not to confuse the issue…
Inch size fasteners (non-metric), like 3/8-16 use a little different method for designating thread pitch. So, a 3/8" (diameter) bolt with a thread pitch of 16, has 16 threads per inch (rater than a distance between threads). A 3/8-16 x 2" length bolt would have 32 threads from head to end (16 x 2").
Have you used a metric ruler very much? Pick up a metric ruler or tape measure and get to know it a bit if you haven’t done so. Try it out! measure how long an 8Mx1.25 bolt is and divide that length by 1.25. Then count the threads. The number should match your math.