Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Date prob


Message #1 by speedguru@m... on Wed, 18 Apr 2001 06:25:36
hi,



i have a table with the following 2 rows



edate 

--------------------------- 

2001-04-15 10:00:00.000

2001-04-15 00:00:00.000





when i try this...





qry="select convert(char(10),edate,101) from e order by edate" 

'to get only the date part of edate



'qry="select edate from events  (tried this too)



set rs=server.CreateObject("adodb.recordset")

rs.open qry,conn



if cdate(rs("edate"))= Date then 



''''''''''''''''''''''''''''''''( also tried

'''''''''''''''''''''''''''''''' if datevalue(rs("edate")) = Date then



..display recs





I cant figure out why I'm getting only 2001-04-15 00:00:00.000 , a single 

record when i should get both the above records...



I've noticed it shows the row only when the timepart is 00:00:00.000 



I want both the rows to be shown...how do i fix this



:-) rk





Message #2 by Naeema Mushaimea <nsameeao@y...> on Wed, 18 Apr 2001 08:00:01 -0700 (PDT)
hi,

  I didn't get you. But I'll give you code and I hope

that is what you need.



<%

'to get a date and time you can use date() and time()

function

response.write date() & "<br>" & time() & "<br>"



'to spearte the date and time use mid function

x="2001-04-15 00:00:00.000"

response.write mid(x,1,10) & "<br>" & mid(x,12,12)

%>



Naeema



******************************************************

--- speedguru@m... wrote:

> hi,

> 

> i have a table with the following 2 rows

> 

> edate 

> --------------------------- 

> 2001-04-15 10:00:00.000

> 2001-04-15 00:00:00.000

> 

> 

> when i try this...

> 

> 

> qry="select convert(char(10),edate,101) from e order

> by edate" 

> 'to get only the date part of edate

> 

> 'qry="select edate from events  (tried this too)

> 

> set rs=server.CreateObject("adodb.recordset")

> rs.open qry,conn

> 

> if cdate(rs("edate"))= Date then 

> 

> ''''''''''''''''''''''''''''''''( also tried

> '''''''''''''''''''''''''''''''' if

> datevalue(rs("edate")) = Date then

> 

> ..display recs

> 

> 

> I cant figure out why I'm getting only 2001-04-15

> 00:00:00.000 , a single 

> record when i should get both the above records...

> 

> I've noticed it shows the row only when the timepart

> is 00:00:00.000 

> 

> I want both the rows to be shown...how do i fix this

> 

> :-) rk

> 

> 
Message #3 by "Charles Feduke" <webmaster@r...> on Wed, 18 Apr 2001 11:28:07 -0400
	This might sound stupid, but if you're using ASP, have you been doing the

rsRecordset.MoveNext to move to the next record?  I'm not sure if you're

just testing thru Query Analyzer or what.



- Chuck



> -----Original Message-----

> From: Naeema Mushaimea [mailto:nsameeao@y...]

> Sent: Wednesday, April 18, 2001 11:00 AM

> To: ASP Databases

> Subject: [asp_databases] Re: Date prob

>

>

> hi,

>   I didn't get you. But I'll give you code and I hope

> that is what you need.

>

> <%

> 'to get a date and time you can use date() and time()

> function

> response.write date() & "<br>" & time() & "<br>"

>

> 'to spearte the date and time use mid function

> x="2001-04-15 00:00:00.000"

> response.write mid(x,1,10) & "<br>" & mid(x,12,12)

> %>

>

> Naeema

>

> ******************************************************

> --- speedguru@m... wrote:

> > hi,

> >

> > i have a table with the following 2 rows

> >

> > edate

> > ---------------------------

> > 2001-04-15 10:00:00.000

> > 2001-04-15 00:00:00.000

> >

> >

> > when i try this...

> >

> >

> > qry="select convert(char(10),edate,101) from e order

> > by edate"

> > 'to get only the date part of edate

> >

> > 'qry="select edate from events  (tried this too)

> >

> > set rs=server.CreateObject("adodb.recordset")

> > rs.open qry,conn

> >

> > if cdate(rs("edate"))= Date then

> >

> > ''''''''''''''''''''''''''''''''( also tried

> > '''''''''''''''''''''''''''''''' if

> > datevalue(rs("edate")) = Date then

> >

> > ..display recs

> >

> >

> > I cant figure out why I'm getting only 2001-04-15

> > 00:00:00.000 , a single

> > record when i should get both the above records...

> >

> > I've noticed it shows the row only when the timepart

> > is 00:00:00.000

> >

> > I want both the rows to be shown...how do i fix this

> >

> > :-) rk

> >

>

  Return to Index