Quantum logic gates are important for quantum computations and quantum information processing in numerous physical systems. While time-bin qubits are suited for quantum communications over optical fiber, many essential quantum logic gates for them have not yet been realized. Here, we demonstrated a controlled-phase (C-Phase) gate for time-bin qubits that uses a 2x2 optical switch based on an electro-optic modulator. A Hong-Ou-Mandel interference measurement showed that the switch could work as a time-dependent beam splitter with a variable spitting ratio. We confirmed that two independent time-bin qubits were entangled as a result of the C-Phase gate operation with the switch.