c# - Date format pattern -



c# - Date format pattern -

setting format date

@string.format("{0:d}", model.date)

code above shows date in next format: (13 jan 2012)

the required output: (friday 13 jan 2012)

is there format pattern?

yep, here go.

string.format("{0:dddd d mmmm yyyy}", model.date)

full msdn documentation

the general rule utilize remember these formats this:

one character means number alone; 2 characters means add together leading 0 if necessary 3 characters means utilize 3 letters if day or month, 4 numbers year 4 letters means utilize total word day or month stuff (not special characters) gets set in string

e.g. consider 1st jan 2001

string.format("{0:(d;dd;ddd;dddd),(m;mm;mmm;mmmm),(y,yy,yyy,yyyy)}", datetime.parse("2001/01/01"))

will return

(1;01;mon;monday),(1;01;jan;january),(1,01,2001,2001)

similar rules times, this:

string.format("{0:(h;hh):(m;mm):(s,ss) (t,tt)}", datetime.now)

to give this:

(9;09):(41;41):(34,34) (p,pm)

c# asp.net-mvc-3

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -