How can I convert date to string format using calculation logic?