displaying date in asp.net

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
i want to display date column in a datagrid in the format dd/mm/yy
using sqlserver2000
 
Hi

If you are creating the columns yourself in the DataGrid (i.e. AutoGenerateColumns=False) then you can use the DataFormatString property of the BoundColumn to specify how the data will be formatted. For example, it may have a format of:
VB.NET:
[COLOR=#ff0000]DataFormatString[/COLOR][COLOR=#0000ff]="{0:dd/MM/yy}"[/COLOR]

Alternatively, you can have SQL Server return the date in the format you require by using the CONVERT method and applying the appropriate style:
VB.NET:
[COLOR=yellowgreen]-- style 3 = British/French without century. For century add 100[/COLOR]
[COLOR=#0000ff]SELECT CONVERT(VarChar, GetDate(), 3) As MyDate[/COLOR]



HTH
 
dbt in date

thk u 4 ur response
i am creating any column in datagrid
the column which in the backend(sqlserver2000),i am trying to retrieve from there
i am using format(col_name,'DD/mm/yy")
then the format is displayed in textbox or label
but i want to display in a grid according to my req. format
 
Back
Top