In my proj i'm using ms-access DB.. i have two fields namely sms_date,sms_time.. i myself enter the records to the DB..
I need to populate the gridview with the records within the given range of date.. i hav a calendar control to select the date(mm/dd/yyyy) and user should type the time(hh:mm:ss).
But the thing is tat wen i select the date from DB, i get the time also in gridview date field .. ex: 1/3/2011 12:00:00 AM.
Similarly for the time field, it comes default wit the date.. ex: 12/30/1899 12:45:23 AM..
So its givin me error wen i check these date and the date wat i enter in the front end..
In the access DB itself i set the format for sms_date as Shortdate and for time as ShortTime.. but no use wen i get the values into the gridview..
Some1 pls help me out..!!! Thanks..:)

Thanks for the reply.. but watevr in tat link i did it in my access DB already.. i.e i changed the format of date time field.. but wen i get those values into my gridview, the date is displayed wit time (12:00:00 by default) and time is displayed with date (12/30/1899 by default).. how can i get rid of this.. i need oly date in date field and time in time field...

Thanks.. but wat i expected was the following code only...
in the gridview's field tat require date and time jus specify the DataFormatString:

<asp:BoundField DataField="payment_date" HeaderText="Date" DataFormatString="{0:d}"/>
<asp:BoundField DataField="sms_time" SortExpression="SmsTime" DataFormatString="{0:T}"/>

thats it.. it works fine:-)
d-short date(mm/dd/yyyy)
T-Long time(hh:mm:ss)
t-short time(hh:mm)

This question has already been answered. Start a new discussion instead.