Skip to main content
March 26, 2007
Question

MySql DateAdd

  • March 26, 2007
  • 1 reply
  • 520 views
i have the code below which displays a diary of time, next to each time i need to diplay fisrtname.

i am having a problem with the dateadd function on this line, how do i need to format that for MySql

SELECT PlayerFirstName, PlayerSurname, DiaryWith, DiaryTime AS StartTime,
DATE_ADD('DiaryTime',INTERVAL Duration MINUTE) AS EndTime

i am using mysql and my diarytime is in MySQL TIME format

then i have a QofQ with getevents.starttime = MySQL TIME format
and getevents.EndTime = MySQL Time format

<cfset steptime = getevents.starttime>

<cfloop condition="DateCompare(StepTime, getevents.EndTime) LT 1">
<cfquery name="GetAppointment" dbtype="query">
SELECT PlayerFirstName, PlayerSurname, DiaryWith
FROM GetClients
WHERE StartTime <= <cfqueryparam value="#steptime#" cfsqltype="CF_SQL_TIMESTAMP">
AND EndTime >= <cfqueryparam value="#steptime#" cfsqltype="CF_SQL_TIMESTAMP">
</cfquery>
This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
March 31, 2007
Run this and see whether it contains what you need.

<cfquery name="q" datasource="dsn">
select adddate(#now()#,-7) as date1, date_add(#now()#, INTERVAL 7 DAY) as date2
</cfquery>
<cfdump var="#q#">