You can easily do date time conversion in ASP.Net. You can convert date time from one format to other format.
In real application when data comes from external sources at that time chances increase for date time conversion error because both sender and receiver of data has different local date format setting.
May be you want to display or store date time in different format. If you know that date format that come from outside and you need in different format at that time your task become easy.
Here is example for this.
In this, we have one date in string variable in "MM/dd/yyyy" format. Now we convert this date in "dd/MM/yyyy" format. We are using "TryParseExact" method to parse and create DateTime object from date string after that, we convert in our desire format using "ToString" method. You can convert in any date time format.
In real application when data comes from external sources at that time chances increase for date time conversion error because both sender and receiver of data has different local date format setting.
May be you want to display or store date time in different format. If you know that date format that come from outside and you need in different format at that time your task become easy.
Here is example for this.
In this, we have one date in string variable in "MM/dd/yyyy" format. Now we convert this date in "dd/MM/yyyy" format. We are using "TryParseExact" method to parse and create DateTime object from date string after that, we convert in our desire format using "ToString" method. You can convert in any date time format.

