Partial merge of 3ef976ea5ec5b47b813d9f9d09acc5a39692f3ac from zapalotta/PHPQstat to fix date handling.