make date code less horrifying

Change-Id: Ie58ae4773ddea9684dfe28131439d3cadc5f8caa