Require it with composer:
composer require chebur/datetime-factory
services:
# Alias
Chebur\DateTimeFactory\DateTimeFactoryInterface: '@chebur.datetime_factory'
# Service implementing DateTimeFactoryInterface, you can change it with your own implementation
chebur.datetime_factory:
class: Chebur\DateTimeFactory\DateTimeFactory