How do I display a date format in dd/MM/yyyy to ddd, dd/MM/yyyy (Mon, 1/4/2014) format with this logic?

user3195396

Right now I have been given the code below code to get the selected date from a calendar and displays it into a textbox but it's in dd/MM/yyyy format.

txtSMAlerted_PopupControlExtender.Commit(calSMAlerted.SelectedDate.ToShortDateString());
Steve

It is simply a format string passed to the ToString method of the DateTime

 calSMAlerted.SelectedDate.ToString("ddd, dd/MM/yyyy");

The ToString(string) overload of DateTime accepts a Standard Date Format String as well as a Custom Date And Time Format String.
With this last set of rules it is easy to build your required output format.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related