Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format Gridview column

Status
Not open for further replies.

BasicBoy

Programmer
Feb 22, 2008
156
ZA
There are a lot of replies as to formatting the gridview columns on databinding, but I found nothing on formatting the query.

There might be a query possible as follows (but I cannot get it right):

Select Format(MyDate,'dd-MMM-yy') from MyTable

Any help will be appreciated,

Thanks
BB
 
you wouldn't format the query, the query is just getting data. the UI presents the data. this is where formatting should occur.

You *can* convert datetime data types to (n)varchar data types in MS SQL (and other databases as well) with
Code:
covert(varchar, [the date], 101)
I think that formats the date as 09/30/11. there are other formats as well. see BOL SQL help for details or post to the appropriate database forum.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top