Format dates correctly