Ducks are not nocturnal and typically sleep at night when it is dark. In the wild, they roost in trees or sheltered areas to stay safe from predators.
If you keep ducks as pets, it is best to provide them with a dark, quiet place to sleep so they can rest properly.