.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

month format in asp.net

Posted By: Catherine     Posted Date: June 13, 2011    Points:5   Category :C#
Hi i am getting month,day,year in dropdownlist. i want the month as jan,feb......like that. my result should be jan2011.what can i do. i assigned dropdown value to string.

Responses
Author: Gowthammanju             
Posted Date: June 13, 2011     Points: 20   

hi

DateTime d=DateTime.parse("11/01/2005");



now you can specify the format by
d. ToString("dd/MM/yyyy")
d. ToString("dddd - d - MMMM")


or

view this link for more details



http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx#Y1663

http://www.csharp-examples.net/string-format-datetime/

hope it helps

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Sasi Prabhu             
Posted Date: June 13, 2011     Points: 20   

Just Add the items jan,feb,mar,... into Dropdownlist.

Then:
Add to year to it.

string dates=dropdown1.selectedtext + DateTime.Now.Year.ToString();


selectedtext (or) selecteditem.tostring()



Thanks & Regards,
Sasi Prabhu.
Author: axistechnolabs             
Posted Date: June 14, 2011     Points: 20   

are you taking Date field value from database then format it using convert(datetime, datevelue, 101)

[URL=http://www.axistechnolabs.com/technology/ecommerce-development.aspx]ecommerce development company[/URL]
Author: axistechnolabs             
Posted Date: June 14, 2011     Points: 20   

are you taking Date field value from database then format it using convert(datetime, datevelue, 101)

[URL=http://www.axistechnolabs.com/technology/ecommerce-development.aspx]ecommerce development company[/URL]
Author: shiv chandra             
Posted Date: June 14, 2011     Points: 20   

Change string to DateTime, if you want to use as DateTime.
You can convert string to DateTime and vice a versa.

For differnt date time format check following link
http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx#Y1663

Regards
Shiva


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend