Date Formatters

  • Thread starter Thread starter PeteZ
  • Start date Start date
P

PeteZ

There seems to be loads of alternative date formats but not one that suits
what I need.

eg How could I format the current date like:

DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )


- Simon
 
You can try this.

string strDateTime = DateTime.Now.ToString("dd-MMM-yy hh:mm:ss");
Console.WriteLine(strDateTime);
Console.Read();

By hitting F1 when you get ToString() method for DateTime.Now, you will see
the whole list of formatting in MSDN library.
 
Hi

something like this:

string strDate
DateTime dt = DateTime.Now;
strDate = dt.ToString("dd-MM-yy H:mm:ss");

hope this helps
dominic
 
PeteZ said:
There seems to be loads of alternative date formats but not one that suits
what I need.

eg How could I format the current date like:

DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )


- Simon
 
Back
Top