Hi
I'm doing my project in asp.net using C# and sql server 2008.
when i display the information in grid view by default it show the time value as 04/19/2014 12:00:00 AM how to change it to current system time, Or i no need to display the time in that grid view. please help me.
My Table created format is
create table sigup(id int, name varchar(20), date date, address varchar(50));
pls share the solution in for this
my mail id [email protected]
thank you
karthigeyan.S
Loading


Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 23, 2014, 10:34 PM EDT
hi,
try...
also refer
http://www.codeproject.com/Tips/44103/Data-formatting-in-GridView
hope this will help you.
Munesh SharmaRank #174 · 13.9K reputationPosted Mar 23, 2014, 10:08 PM EDT
Protected void Page_Load(object sender, EventArgs e)
{
textbox1.text = System.DateTime.Now.ToString() // for complete time and date
textbox2.text = System.DateTime.Now.ToShortDateString(); // for showing date
textbox3.text = System.DateTime.Now.ToShortTimeString(); // for showing Time
}
If you Don't want to show time in grid view then you have to write query
"select id, name , address from tablename"
Abhay ShankerRank #375 · 6.7K reputationPosted Mar 23, 2014, 10:29 PM EDT
System.DateTime.Now.ToString()
Display the date in Gridview as below:-
Ranjit PowarRank #553 · 4.4K reputationPosted Mar 24, 2014, 2:08 AM EDT
Convert date in select query as follows
convert(varchar,Column name,101) As Column name