Lagrange's Theorem: The order of a group element divides the order of the group.
The order of the group is the number of points on the elliptic curve. There is a polynomial time algorithm (Schoof/Schoof-Elkies-Atkin) to compute the number of points on an elliptic curve over a finite field.
So, to generate an ECC system: You compute the number of points on the curve in polynomial time. Factor that number (not polynomial time in general, but in practice fine) and then determine the order of the point using a standard algorithm (see Section 11.1 of Victor Shoup's book -- free on his webpage).
IMPORTANT: You do not need to solve ECDLP to determine the order of a point.
However, in practice most users do none of this. In cryptosystems (already set up by someone else) the system parameters include $(E, P, k)$. To verify that parameters are correct all one has to do is this: test that $P$ satisfies the curve equation, test that $P$ is not itself the identity element, test that $k$ is prime, compute $[k]P$ and test that this is the identity. It follows that the order of $P$ is equal to $k$. This is a polynomial time computation.