Serialize datetime to transmit it.

Thanks to Tristan Cavelier