I am writing a function to convert Decimal/Datetime to the format specified by user.
For example:
If my input string is 1234.1254 and format string is "000.00" then the output should be 1234.13.
Same goes for Datetime, if input is DateTime.Now and format string is "dd/MM/yyyy" then the date should be returned in the given format.
I am not sure how can I achieve this, any suggestions on how can I proceed here?
Thanks

Satya KarkiRank #78 · 24.6K reputationPosted Jan 20, 2021, 11:09 AM EST
Rijwan AnsariRank #82 · 24.2K reputationPosted Jan 20, 2021, 11:01 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Jan 20, 2021, 6:38 AM EST
for example if user says i want format as dd/mm/yyyy then store that in string pass that to ToString()