The duration of an earthquake is related to its magnitude but not in a perfectly strict sense. There are two ways to think about the duration of an earthquake. The first is the length of time it takes for the fault to rupture and the second is the length of time shaking is felt at any given point (e.g. when someone says "I felt it shake for 10 seconds" they are making a statement about the duration of shaking). The duration of fault rupture is related to both how long it takes for a spot on the fault to slip (which seems to be quite fast) and the time it takes rupture to proceed along a fault.
You have to think of an earthquake as an area on a fault rather than just a point. It starts at a point and then the rupture propagates along the fault at around 2 kilometers or so per second. So the larger the area of the fault that ruptures, the longer the duration of the earthquake. And larger magnitude earthquakes have larger fault areas. So there is a general relationship between duration and magnitude.
The reason we don't list this sort of duration on the Latest Earthquake website is that figuring out how long an earthquake took to rupture is still a research project that takes some time rather than an automated process. The duration of shaking at a point on the ground depends on how long the earthquake took to occur and how the waves move through the ground to that point. If there are a lot of reflections and resonances near the point (for instance in a sedimentary valley), the shaking will last longer. In an area without resonances (for instance on a hard block of rock), it will last a shorter time.
You must also specify a duration of shaking over a given level. We can actually detect the shaking from the very largest earthquakes for weeks after they occur, but no one would say that they felt it for that long. So the duration of shaking is a very complex topic. We actually do use the duration of shaking to estimate the magnitude for some small earthquakes. If you see a "Md" or "duration magnitude" on the Latest Earthquake webpages, this is what has been done.
For an explanation see Magnitude. This is much like having someone yell, counting the echos, and then estimating how loud they yelled from how many echos you could hear. Finally, the damage to a given structure will depend both on the amplitude of the shaking and its duration. How to best combine these quantities into an estimate of the amount of damage is ongoing research. (contributed by Andy Michael)