If you want DB Server time: "Select top 1 getdate() as maxid from tablename;" will do it.
:) JAC -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ferguson, Ken Sent: Tuesday, October 14, 2003 9:15 PM To: [EMAIL PROTECTED] Subject: RE: Current Server Date/Time Hey PJ, all you want is the server date and time??? Just that? Does it HAVE to be the db server date/time or will the webserver date/time work? Why not just use #now()#??? Unless I'm *REALLY* misunderstanding what you're after, this should give you all the data you need. -----Original Message----- From: PJ Gaenir [mailto:[EMAIL PROTECTED] Sent: Tue 10/14/2003 3:46 PM To: [EMAIL PROTECTED] Cc: Subject: Current Server Date/Time I am wondering if there is a more elegant way to get the current server date/time than the way I've been doing it. The way I've been doing it works about 99.8% of the time and then, inexplicably, doesn't and I don't know why, but it throws an error. I made a tiny table with two fields, one is datetime type. I insert a single record with getdate() then grab its value right after. I cfset the date value as a var. Then I do a datecompare. But once in a great while the date value 'set' ends up blank--no clue why. So I guess I need to find a different way to accomplish this. Sample code follows. <cftransaction> <cfquery name="inow" datasource="#variables.odbcd#"> insert into tb_temp1 (temp1now) values (getdate())</cfquery> <cfquery name="maxid" datasource="#variables.odbcd#"> select max(temp1id) as maxid from tb_temp1</cfquery> </cftransaction> <cfquery name="timenow" datasource="#variables.odbcd#"> select temp1now from tb_temp1 where temp1id = #maxid.maxid#</cfquery> <cfset newnow = '#DateFormat(timenow.temp1now,"mm/dd/yyyy")# #TimeFormat(timenow.temp1now,"hh:mm:ss tt")#'> Then (using a value pulled from a query on test settings): <cfset precision = 's'> <CFSET okopen = DateCompare(variables.newopen, variables.newnow, variables.precision)> And about 1 out of every... maybe 150 times this runs, I get the error: ------------- An error occurred while evaluating the expression: okopen = DateCompare(variables.newopen, variables.newnow, variables.precision) Parameter 2 of function DateCompare which is now " " must be a date/time value ------------- It's just often enough to really annoy a customer with 500 students testing a week, and just rare enough to seem like it OUGHT to work, code-wise. Does anybody have any ideas? I open to just about anything by now. :-) Best regards, PJ --- [This E-mail scanned for viruses by Declude Virus] ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org NjqIP u~r{rz ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
