Sinusoidal voltage signals are often converted to square waves using Zero-Crossing detectors. In this circuit, Op-Amp operates in the open-loop comparator mode. The supply voltage can be single or dual. This circuit is generally used to start a process after zero-crossing, like turning ON the load or generating a firing pulse through a microcontroller by starting the timers or counting the cycles or frequency of alternating voltage signal, etc.
When the input signal is connected to V+ and V- is grounded, as the input voltage rises above the ground voltage i.e, when the input is positive, the output of the Op-Amp is +Vsat and the output is –Vsat while the input is negative.
Op-Amp as a Non-Inverting Zero-Crossing detector

Alternatively, when the input signal is connected to V- and V+ is grounded, as the input voltage rises above the ground voltage i.e., when the input is positive, the output of the Op-Amp is -Vsat and the output is +Vsat while the input is negative. This difference is used when the input signal is obtained from the secondary of a transformer, and square wave output is to be used for some other applications.
Op-Amp as Inverting Zero-Crossing detector

However, suitable filter circuits must be inserted between the input signal and the Op-Amp circuit in order to eliminate harmonics.
A sinusoidal alternating current can be represented by the equation i = I sin ωt, where i is the current at time t and I the maximum current. In a similar way, we can write for a sinusoidal alternating voltage v = V sin ωt, where v is the voltage at time t and V is the maximum voltage.
We imagine a sinusoidal signal y=Y sin ωt, i.e. amplitude Y and angular frequency ω, as being produced by a radial line of length Y rotating with a constant angular velocity ω (Figure 11.2), taking the vertical projection y of the line at any instant of time to represent the value of the sinusoidal signal.