Sets date correctly