Hi,
You didnt understand some basic stuff, so i tell you what you
should have done:
"The value "27/3/2007" could not be converted to a date."
<cfset myDate="form.Diary_Date">
this line you create myDate parameter with value from form,
Diary_Date field.
you should use # signs because coldfusion doesnt know
otherwise you want to use cf parameters value.
in other words otherwise you are telling coldfusion that
mydate is string containing literaly "form..Diary_Date".
take care you always trim parameter values from forms, same
browsers are so nice to adding extra enter character at end of
field value. so first line goes:
<cfset myDate="#Trim(form.Diary_Date)#">
now, sence myDate parameter is fine, lets focus few minutes
how you split value from myDate to tree different pieces.
GetToken fuction is nice fellow when you want split
preformated string to pieces, preformated mean that string always
look same kind. just like dates. year, month and day are in same
positions at string, while year might be different.
example: 1.1.2007 and 1.1.2003, get it?
usage of gettoken is very simple, you just tell function
first parameter where he has to split you piece of string and
second
you tell number of piece to look for and last you tell what
character is separator of each piece.
so, since date you want to process is "27/3/2007", date is
first, month next and year last.
separator is "/" so, getting month should be like this:
myDate is parameter is strinng to be splitted.
number 2 is order number, month is second piece at string
/ is piece separator.
Following code will give you substring "3" from string
"27/3/2007".
<cfset myDate_Month = "#GetToken(myDate,2,"/")#">
Can you repair your self next two lines?
<cfset myDate_Day = "#GetToken(myDate,1,"\")#">
<cfset myDate_Year = "#GetToken(myDate,3,"\")#">
Cheers
Kim