Fixed issues with date format when saving and then retrieving from database