Updated version, Added date format function