Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 display date in a gride

Author  Topic 

awadi20
Starting Member

10 Posts

Posted - 2007-06-25 : 17:58:38
hello,
i use asp.net 2, i have a sql database, it has a datetime field,the data in this field like 25/06/2007. when i selected this recode in asp.net and fill data in a grid it display like 25/06/2007 12:00:00 AM.
how can i get the data dd MM yyyy?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-25 : 18:00:40
Use the dataformatstring at the front end.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

awadi20
Starting Member

10 Posts

Posted - 2007-06-26 : 03:35:22
thanks for ur replay. but this is the first time i use asp.net2 so would u please to explane more. how can i do that. i have two selected item will fill in the gride, the first one is (nvarchar) and the second is date.

tanks a lot
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-26 : 03:50:25
See this:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx
http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

awadi20
Starting Member

10 Posts

Posted - 2007-06-26 : 18:41:38
i used this statment select convert(char(10), the field name,111)
this display date as 2007/06/25 but
how can i display it like 2007/06/25 monday
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-26 : 19:54:11
[code]SELECT CONVERT(CHAR(10), GETDATE(), 111) + ' ' + DATENAME(weekday, GETDATE())[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

awadi20
Starting Member

10 Posts

Posted - 2007-06-27 : 02:34:41
thanks khtan for ur help, it works now
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-27 : 02:49:15
Note that you can do this more easily and efficiently from the Front-end rather than from SQL.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-27 : 08:57:06
I dont know .NET syntax. In VB6, it would be

Format(Rs("datecol"),"yyyy/mm/dd dddd")

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

awadi20
Starting Member

10 Posts

Posted - 2007-06-27 : 18:24:42
thank u all for ur help
Go to Top of Page
   

- Advertisement -