I think I've got it:

DateFormat(CreateODBCDate(#form.DepartureDateTxt#),'dd/mm/yyyy')

Seems to do it ;)

Cheers anyway,
James

 

-----Original Message-----
From: James Buckingham [mailto:[EMAIL PROTECTED] 
Sent: 22 January 2004 14:02
To: '[EMAIL PROTECTED]'
Subject: [ cf-dev ] Updating a Date into a Database

Afternoon guys,
 
I'm a bit stuck with some dates functions I'm working with and wondered if
anyone can help. I've got a form which is  used to Amend information in an
Access DB. When the user clicks the 'Amend' button the information in sent
to a query to update the appropriate field. I can get it update everything
though apart from the Departure and Return Date fields. These are set to
Date/Time in Access. 
 
I sent a question in earlier and got this reply from Stephen Moretti:
 
"DateTime fields in Access need to be fed ODBC formatted date/times either
using CreateODBCDate/CreateODBCDateTime or <cfqueryparam> You don't need to
wrap odbc datetimes in quotes."
 
I've messed around with these ideas but no matter what I try I get an error
message coming back. Here's what I've got at the moment:
 
<cfquery datasource="#application.datasource#" name="update_record2">
<cfset Departure_Date = createODBCDate(#form.DepartureDateTxt#)>
 <cfset Return_Date = createODBCDate(#form.ReturnDateTxt#)>
 
 UPDATE Tour_dates
 SET Tour_dates.departuredates = '#Departure_Date#'
   , Tour_dates.returndates = '#Return_Date#'
   , Tour_dates.fares = '#form.FaresTxt#'
 WHERE (Tour_dates.Date_ID=#url.Tour_ID#) AND (Tour_dates.Tour_ID=#url.ID#)
</cfquery>
 
I've done a CFOUTPUT of the SET Departure_Date and it comes out as {d
'2004-11-09'} I've also tried converting it using DateFormat first and then
inserting it but nothing is working.
 
Can anyone give me some pointers?
 
Cheers,
James

-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to