Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Date & Time


Message #1 by "Dale Wright" <dwright@c...> on Fri, 4 Oct 2002 14:39:02
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 "Craig Flannigan" <ckf@k...> on Fri, 4 Oct 2002 14:42:46 +0100
I use this when searching for a DATE only.


CDate(Format([Your_FieldName_Here],'dd/mmm/yyyy'))

E.G...

WHERE txtDate = #" &  CDate(Format([Your_FieldName_Here],'dd/mmm/yyyy')) &
"#;"



HTH
Craig.


-----Original Message-----
From: Dale Wright [mailto:dwright@c...]
Sent: 04 October 2002 14:39
To: ASP Databases
Subject: [asp_databases] 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

_____________________________________________________________________
Please contact I.T. Support if you have received this email in error.
This e-mail has been scanned for all viruses by Star Internet.
_____________________________________________________________________


_____________________________________________________________________
Kingfield Heath Ltd. Email Disclaimer

Confidentiality : This email and its attachments are intended for the
above-named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or
show them to anyone; please reply to this email and highlight the
error.

Security Warning : Please note that this email has been created in
the knowledge that the internet is not a 100% secure communications
medium. We advise that you understand and observe this lack of
security when emailing us.

Viruses : Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that, in keeping with
good computing practice, the recipient should ensure they are
actually virus free.
_____________________________________________________________________
Message #3 by "Dale Wright" <dwright@c...> on Fri, 4 Oct 2002 15:37:56
Cheers for the reply, but it aint doing anything.... is there anychance 
you can show me how to mod my code to do this? cheers



Dim oConn
	Dim oRS
	Dim Sqltxt
	Dim Sqldate	
	
	Set oConn = Server.CreateObject("ADODB.Connection")
	Set oRS = Server.CreateObject("ADODB.Recordset")
		
		SQLtxt = "SELECT Calls.Callid, Calls.ContactID, 
Calls.Forename, CallsHistory.Action, Calls.Surname, Calls.Email, 
CallsHistory.Notes, Calls.DateClosed "
		SQLtxt = SQLtxt & " FROM Calls INNER JOIN CallsHistory ON 
Calls.Callid = CallsHistory.FKey "
		SQLtxt = SQLtxt & " WHERE (((CallsHistory.Action)=4)) 
ORDER BY Calls.CallID;" 

		oRS.Open SQLtxt,"DSN=sunrise_db"

		Sqldate

	While Not oRS.EOF
			
		If oRS("DateClosed") = Date() Then

DO SOMETHING..........
Message #4 by "Craig Flannigan" <ckf@k...> on Fri, 4 Oct 2002 15:38:55 +0100
I'll try!

Looking at your code, your WHERE clause does not contain any reference to
the date - would it not be best to put the Date into the WHERE clause so
that you only return those calls closed on a certain date?

If you're wanting all results shown, and then to check the date, the
command:
 --> CDate(Format(Calls.DateClosed,'dd/mmm/yyyy')) & "#)

doesn't want to be in your SQL.


'-------[ CODE ] -----------------

Dim oConn
Dim oRS
Dim Sqltxt
Dim Sqldate

Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")

SQLtxt = SQLtxt & "SELECT Calls.Callid, Calls.ContactID, "
SQLtxt = SQLtxt & "Calls.Forename, CallsHistory.Action, Calls.Surname,
Calls.Email, "
SQLtxt = SQLtxt & "CallsHistory.Notes, Calls.DateClosed "
SQLtxt = SQLtxt & "FROM Calls INNER JOIN CallsHistory ON Calls.Callid 
CallsHistory.FKey "
SQLtxt = SQLtxt & "WHERE (((CallsHistory.Action)=4))
SQLtxt = SQLtxt & "AND (Calls.DateClosed = #" &
CDate(Format(Calls.DateClosed,'dd/mmm/yyyy')) & "#) "
SQLtxt = SQLtxt & "ORDER BY Calls.CallID;"

oRS.Open SQLtxt,"DSN=sunrise_db"



'------------- UNSURE ABOUT BELOW THIS LINE ---------
Sqldate

While Not oRS.EOF
	If oRS("DateClosed") = Date() Then




-----Original Message-----
From: Dale Wright [mailto:dwright@c...]
Sent: 04 October 2002 15:38
To: ASP Databases
Subject: [asp_databases] RE: Date & Time


Cheers for the reply, but it aint doing anything.... is there anychance
you can show me how to mod my code to do this? cheers



Dim oConn
	Dim oRS
	Dim Sqltxt
	Dim Sqldate

	Set oConn = Server.CreateObject("ADODB.Connection")
	Set oRS = Server.CreateObject("ADODB.Recordset")

		SQLtxt = "SELECT Calls.Callid, Calls.ContactID,
Calls.Forename, CallsHistory.Action, Calls.Surname, Calls.Email,
CallsHistory.Notes, Calls.DateClosed "
		SQLtxt = SQLtxt & " FROM Calls INNER JOIN CallsHistory ON
Calls.Callid = CallsHistory.FKey "
		SQLtxt = SQLtxt & " WHERE (((CallsHistory.Action)=4))
ORDER BY Calls.CallID;"

		oRS.Open SQLtxt,"DSN=sunrise_db"

		Sqldate

	While Not oRS.EOF

		If oRS("DateClosed") = Date() Then

DO SOMETHING..........

_____________________________________________________________________
Please contact I.T. Support if you have received this email in error.
This e-mail has been scanned for all viruses by Star Internet.
_____________________________________________________________________


_____________________________________________________________________
Kingfield Heath Ltd. Email Disclaimer

Confidentiality : This email and its attachments are intended for the
above-named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or
show them to anyone; please reply to this email and highlight the
error.

Security Warning : Please note that this email has been created in
the knowledge that the internet is not a 100% secure communications
medium. We advise that you understand and observe this lack of
security when emailing us.

Viruses : Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that, in keeping with
good computing practice, the recipient should ensure they are
actually virus free.
_____________________________________________________________________
Message #5 by "Dale Wright" <dwright@c...> on Fri, 4 Oct 2002 15:56:19
PROBLEM NOW SOLVED.... Should have switched my brain on before i 
posted...thanks for the help

  Return to Index