Change the date time format in Asp.net c#

DateTime dt = DateTime.Now; // get current date time
txtFormat.Text = string.Format("{0:yyyy/dd/MMM hh:mm:ss}", dt); // you can specify format according to your need
 
/* Format can be such as
dd/mm/yy
dd/mmm/yyyy
mmm/dd/yy
mm/dd/yy
mm/dd/yyyy
Note : you can use any separator in format .
*/
Ebook Download
View all
FileInfo in C#
Read by 9.7k people
Download Now!
Learn
View all