working with date & time & factory pattern