Vinnie

Vinnie

  • NA
  • 11
  • 0

Urgent - Please help with formating date in Visual C# app

Aug 18 2007 4:09 PM

I have one class for formating date in my web app. The date should be the same for every object in app and should be as a NEWSTRING

   public const string NEWSTRING = "dd/MM/yy HH:mm";

    public static string FormatDate(DateTime date) {
        return date.ToString(NEWSTRING);
    }

When I try to convert for example
    Text1.Text = FormatDate(currentDate); 

where currentDate is:
    DateTime currentDate = "yyyy-mm-dd hh:mm:ss"

I get as the result dd-mm-yy hh:mm instead of dd/MM/yy HH:mm

How can I get the date in format dd/MM/yy HH:mm by using my FormatDate ?


Answers (4)