i want to display only date not time

Posted by Amar888 under Regular Expressions on 4/25/2010 | Views : 6120 | Status : [Member] | Replies : 6
hi,
in my form i entered all feilds in that i have date ,i use to view in grid in my grid i have edit button if i click it shows date and time ,but i want only date .

i used like datetime dt = datetime.now;
txtreqdate.Text = dt1.ToShortDateString();

but it takes only current date pls send me solution




Responses

Posted by: Syedshakeer on: 4/25/2010 [Member] Starter

Up
0
Down
Hi,your question is not clear.

Syed Shakeer Hussain

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 4/25/2010 [Member] Starter

Up
0
Down
Check the following link to store diffarent date format in Gridview..www.dotnetspark.com/kb/1658-date-formating-gridview.aspx

Syed Shakeer Hussain

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 4/25/2010 [Member] Starter

Up
0
Down
Check the following ling to get a date using c#. www.csharp-examples.net/string-format-datetime

Syed Shakeer Hussain

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 4/25/2010 [Member] Starter

Up
0
Down
In the grid, write something like

DateTime.Convert(Eval("DateTimeFieldName").ToString()).ToShortDateString();


This should be written in the TemplateColumn.

Regards,
Raja, USA

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenmanam on: 4/26/2010 [Member] Starter

Up
0
Down
<asp:BoundField DataField="MyDate" DataFormatString="{0:d}" HeaderText="DaDate" />

NaveenKumar

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bujji on: 4/27/2010 [Member] Starter

Up
0
Down
There is one property for Grid
Datetimeformatstring = {0:d} this will only display the date

Amar888, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response