Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Date & Time


Message #1 by "Dale James Wright" <dwright@c...> on Fri, 4 Oct 2002 14:36:37
Alright folks, after solving my issues... i have gathered that i might 
have wasted my time....After looking @ the database structure(third party 
database) i have found that the database has Date & TIME fields (ie one 
field is date &time togeather, not separte.) Now this is going to cause me 
huge problems as my code checks for TODAYS date before it carrys out an 
action.. I cant change the date&time field to just date format as this 
would mess up the thrid party system. Is there any way that you can get 
ASP to check JUST FOR THE DATE and not the TIME??? I am very new to 
this.... hope someone can help!

Cheers
Message #2 by Karri Peterson <KPeterson@C...> on Fri, 4 Oct 2002 08:34:37 -0500
Dale,

Convert the date/time value pulled out of Access into a string and then
parse that string so that you separate the Date value and the Time value.

so it might be something like this (I wrote this just for you--it is written
for the command line, but if you want to convert it to ASP, use
Response.Write in place of Wscript.echo and don't forget to put it in <% %>
)

Wscript.echo now  'to find a sample date/time value, I used the vbscript
keyword 'now'.
			'it returned the value 10/4/2002 8:32:48 AM, and I
took this and converted it to a string.
			'you're going to have to experiment with the value
you get out of Access to see what format 
			'it is in, but in general, once you get the value
back, and convert it to a string, you can
			'use a split function using a space (" ") as a
delimiter to put the string's pieces into an array.

sString = cstr(now)

sArray = split(sString, " ")

Wscript.echo sArray(0)  'in this case, 10/4/2002 came back for this value
Wscript.echo sArray(1)  'in this case, 8:32:48 came back for this value
Wscript.echo sArray(2)  'in this case AM came back for this value


''once you get these values into an array, then you can manipulate them
anyway you need to...

sDate = sArray(0)
sTime = sArray(1) & " " & sArray(2)
Wscript.echo "The date is " & sDate
Wscript.echo "The time is " & sTime


Hope this helps.

Karri




-----Original Message-----
From: Dale James Wright [mailto:dwright@c...]
Sent: Friday, October 04, 2002 9:37 AM
To: Access ASP
Subject: [access_asp] Date & Time


Alright folks, after solving my issues... i have gathered that i might 
have wasted my time....After looking @ the database structure(third party 
database) i have found that the database has Date & TIME fields (ie one 
field is date &time togeather, not separte.) Now this is going to cause me 
huge problems as my code checks for TODAYS date before it carrys out an 
action.. I cant change the date&time field to just date format as this 
would mess up the thrid party system. Is there any way that you can get 
ASP to check JUST FOR THE DATE and not the TIME??? I am very new to 
this.... hope someone can help!

Cheers
Message #3 by "Ken Schaefer" <ken@a...> on Mon, 7 Oct 2002 14:51:55 +1000
strSQL = _
    "SELECT Field1, Field1 " & _
    "FROM Table1 " & _
    "WHERE DateDiff(""d"", Date(), DateFieldInDatabase) = 0"

Set objRS = objConn.Execute(strSQL)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Dale James Wright" <dwright@c...>
Subject: [access_asp] Date & Time


: Alright folks, after solving my issues... i have gathered that i might
: have wasted my time....After looking @ the database structure(third party
: database) i have found that the database has Date & TIME fields (ie one
: field is date &time togeather, not separte.) Now this is going to cause me
: huge problems as my code checks for TODAYS date before it carrys out an
: action.. I cant change the date&time field to just date format as this
: would mess up the thrid party system. Is there any way that you can get
: ASP to check JUST FOR THE DATE and not the TIME??? I am very new to
: this.... hope someone can help!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index