Extracting Date, Time and Datetime from ruby-hl7

The methods "to_hl7" used to be on ruby-hl7 file.
Also, did some refactoring for reducing
the code duplication.   Before that, I've added
some test.