said by Bob4:
Other possibilities are a broken thermostat, a broken dip tube, or the hot and cold pipes are backwards.
Definitely check this. Connecting the water heater backwards is an easy mistake for a spaced out plumber, and will result in nearly zero usable hot water. If plumbed backwards, so that water is drawn from the "C" port, the "hot" water is being drawn from the very bottom of the tank, through the dip tube. So you'd be drawing cold water, while plenty of buoyant hot water is floating in the tank above the denser cold water that you're drawing.
Water should go in "C" and come out "H", this way, cold water is injected at the bottom of the tank, and hot water is drawn off the top.