Datetime encoders and decoders