.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 >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Split today date and month,year

Posted By:laptop charles       Posted Date: October 10, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

Split today date and month,year from full date format, using c# split method.
 

It has one text box, one is used to get the input, one dropdownlist is used to  display the output for seprate day,month,year and one button.
using System;
using System.Data;
using System.Collections ;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        String dob="";
        dob = txtdate.Text;

        String[] ch = dob.Split(new char[] { '/' });


       
       
                ddl.Items.Add(ch[0]);
                ddl.Items.Add(ch[1]);
                ddl.Items.Add(ch[2]);

    }
}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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