asp.net - C# - Formatting DateTime to Month -
this question has reply here:
datetime convert int month name in c#, silverlight 3 answersi retrieving datetime db coming through in dropdown list total date , time. need month datetime in word format in drop downwards list.
as below:
[system.web.services.webmethod] public static string onchainchange(string chainid) { datatable table = dbhelper.getmonthlist(chainid.trim()); string result = string.empty; foreach (datarow dr in table.rows) { datetime thisdate = convert.todatetime(dr["fromdate"].tostring()); result += new listitem(thisdate.tostring("mmmm"), thisdate.month.tostring("mmmm")); //result += dr["fromdate"].tostring() + ";"; } homecoming result; }
lb - question different. trying new listitem. understand how convert datetime int. love find duplicate reply that! :)
the problem
thisdate.month.tostring("mmmm")
datetime.month
of type int
, if trying add together value utilize
thisdate.month.tostring() //without passing in parameter
if want value month name use:
thisdate.tostring("mmmm")
instead of passing parameter tostring
, end values set mmmm
c# asp.net web-services datetime drop-down-menu
No comments:
Post a Comment