create function for switch date format