If you are asking about when the Constitution was ratified, as opposed to when it was written or when it went into effect, the answer is 1788. The Constitution was written in 1787. It was ratified in 1788. It went into effect in 1789.
When the Constitution was written, the Framers stipulated that it would be officially ratified when two-thirds of the 13 states voted to accept it. This meant that the Constitution was officially ratified when the 9th state voted to ratify it. The ninth state to ratify the Constitution was New Hampshire, which ratified it on June 21, 1788. Although the Constitution was officially ratified when that happened, it did not take effect until March 4, 1789. Two states ratified the Constitution after it was already in effect. The last of these, Rhode Island, did not ratify until May 29, 1790.