When you started living there.
New York determines your residency for tax purposes if you are domiciled in New York. They define domicile as: your permanent and primary residence that you intend to return to and/or remain in after being away
This link will tell you more:
NY Residencey