DateTime Conversion
-
Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu
Babu
-
Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu
Babu
-
Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu
Babu
Or you can use: txtBookDate.Text = dat.ToShortDateString() ;
-
Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu
Babu
Man try this ............................................... DateTime dat = DateTime.Now; txtBookDate.Text = dat.ToShortDateString(); txtBookTime.Text = dat.ToShortTimeString();
Do good and have good.