Fix format datetime bug