According to Futility Closet,
In most elevators installed since the early 1990s, the “close door” button has no effect. Otis Elevator engineers confirmed the fact to the Wall Street Journal in 2003.
Most other online articles ultimately all point to the same resource.
The WSJ article is: Sandberg, Jared. (January 15, 2003) "Employees Only Think They Control Thermostat". The actual quote from the article is:
That's just one of several examples where the mere illusion of control seems to satisfy us. Plenty of placebo buttons give the same false impression. That "close door" button on elevators? It won't work unless you're a fireman or an elevator operator with special access to the system. The rest of the time, in deference to various building codes, it's deactivated, according to engineers at Otis Elevator.
Note the reference to building codes. This might well vary from city to city, and therefore be true in some places (say, New York City, where WSJ is published) and false in others.
I found another reference in a New Yorker article that seems to indicate this change dates from the 1990s:
In most elevators, at least in any built or installed since the early nineties, the door-close button doesn’t work. It is there mainly to make you think it works. (It does work if, say, a fireman needs to take control. But you need a key, and a fire, to do that.)
Perhaps that is when the building codes changed? I tried looking this up in the New York City building code, and saw nothing specifically mentioning buttons inside the car. (I will admit to being bad at reading legalese like this, its not very accessible prose). However, like most local building codes in the US, they defer to national standards as set by ASME:
3001.2 Referenced standards. Except as otherwise provided for in this code, the design, construction, installation, alteration, repair and maintenance of elevators and other conveying systems and their components shall conform to ASME A17.1 as modified by Appendix K, ASME A17.2, ASME A18.1, ASME A17.5, ANSI A10.5, ASME QE1-1, ASME A90.1, ASME B20.1 as modified by Appendix K, ALI ALCTV, and for construction in areas of special flood hazard, Appendix G.
Only the table of contents of ASME A17.1 (PDF link) is online, ASME charges several hundred dollars to purchase this book, so I can't directly check it for the rules on close door buttons.