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 .
*/
Sometimes we need to change the date format, according to the country standard date time. There is a code of a very few lines that helps you to keep the date time in any format.
Join the conversation! Your thoughts help the community grow.
Join to leave a comment
Members earn 10 SHARP for a comment, 10 SHARP for a reaction, and 250 SHARP for every blog they publish.
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegisterMembers onlyeBook · C#Modern CSharp Mastery - Advanced Guide for Experienced DevelopersDownload nowWrite a blog post and earn +250 SHARP when it is approved.
Write a blog
Raja RajanPosted Aug 23, 2015, 11:00 PM EDT
really it works......