We experimentally demonstrated that both the electronic Kerr effect and the molecular alignment in gaseous molecules could be applied as transient gates to diagnose 400 nm target pulses. Their birefringence dissimilarity was clearly visualized by the measured spectrogram and retrieved gate function. In the atomic gas argon, a relatively weak and instantaneous cross phase modulation within the pulse duration was observed, while in the molecular gas N(2), the delayed rotational Raman excitation played a dominative role.