[PATCH 1/2 v2] A function for resolving date format and order