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

Top 5 Contributors of the Month

Post New Resource Bookmark and Share   

Split today date only

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

Split today date only from full date format, using c# split method.

It has two text box, one is used to get the input,other one is display the output 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 
    DateTime dat, tme;
    protected void Button1_Click(object sender, EventArgs e)
        String dob="";
        dob = txtdate.Text;

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

            dat=DateTime.Now ;
            tme = DateTime.Now;

                TextBox1.Text = ch[0];



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

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