Date and time....... [Resolved]

Posted by Naveenmanam under ASP.NET on 4/27/2010 | Views : 1522 | Status : [Member] | Replies : 8
i have one table with date column with datetime datatype. when i display it in gridview it shows like 4/19/2010 12:00:00 AM. now the problem is my client wants to get exat time also when he entered in to database.

like 4/19/2010 04:24:58 PM.

NaveenKumar


Responses

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

Up
0
Down

Resolved
thank you shakeer
i got it..


time. String str=DateTime.Now.ToString()

NaveenKumar

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

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

Up
0
Down
i thing you are storing only data that why while retrieve datetime it showing 12:00:00 AM.

while insert record use GETDATE() SQL function to store current date with time

from front end use

DateTime.now it will return current date with time

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

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

Up
0
Down
ya your guessing is currect but clint system not resive the live time..?

NaveenKumar

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

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

Up
0
Down
Hi,use the following code to get a date and time. String str=DateTime.Now.ToString()

Syed Shakeer Hussain

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

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

Up
0
Down
it possible can you post your code , how you are binding into grid with DB values?. it easy to identify the problem

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

Posted by: Pavanandey on: 4/28/2010 [Member] Bronze

Up
0
Down
then u can get the current date with time in sql server by using the function GEtdate(), by using this u can get the current datetime,

insert into table(datatimecol) values(getdate())

Thanks
Pavan Kumar
Mark Answer if this fits the need

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

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

Up
0
Down
thank you muhilan


NaveenKumar

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

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

Up
0
Down
thank you pavan kumar

i got it..

NaveenKumar

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

Login to post response