format datetime and fix file not exist issue