asp.net - datagrid and date?

M

Morten

Hi.

I have a problem getting date coorect in my datagrid.
Date in the database is integer like this 20010614
I create a View and I have tried cast but I can not get passed dd.mm.yyyy
hh:mm:ss
I want the date in the grid to come out as dd.mm.yyyy

Any ideas?

Thanks

Morten
 
D

Deepankar

Hi,
I would prefer to do the conversion in the backend
Something like this
declare @m int
set @m = 20010605

select cast(substring(cast(@m as varchar(10)),1,4) + '.' +
substring(cast(@m as varchar(10)),4,2)
+ '.' + substring(cast(@m as varchar(10)),8,2) as datetime)

Thanx
Deep
 
M

Morten

Thanks Deepankar


Deepankar said:
Hi,
I would prefer to do the conversion in the backend
Something like this
declare @m int
set @m = 20010605

select cast(substring(cast(@m as varchar(10)),1,4) + '.' +
substring(cast(@m as varchar(10)),4,2)
+ '.' + substring(cast(@m as varchar(10)),8,2) as datetime)

Thanx
Deep
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top