APS NZ
asked on
Converting a File Date to a recognised ColdFusion format
I need to be able to allow a user to enter a date into a form, and on processing the form I need to open a file which has a last modified date which is the same as "form.MyDate". I have tried using CFDirectory and reading Name.DateLastModified, but I get the following error:
The value "Wednesday, 4 January 2006 12:42:48 PM NZDT" could not be converted to a date. Is there an easy way of converting that value into a dd/mm/yyyy value?
TIA
John
The value "Wednesday, 4 January 2006 12:42:48 PM NZDT" could not be converted to a date. Is there an easy way of converting that value into a dd/mm/yyyy value?
TIA
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I must have had a lapse in my email. I didn't see your post on 3/23. I assume you got it figured out. Sorry for not helping further. I suspect the problem was the EQ #MyDate# instead of a range... like GTE LTE, or both with two dates to check a range...
ASKER
I cheated in the end and parsed the long date as shown in my question. I think you are correct about the EQ because I still had trouble within the query from the directory and i had to use more than one cfif to get it sorted.
Thanks for your help.
John
Thanks for your help.
John
ASKER
Here is my code (CF 6.1)
<CFSET MyDate = CreateODBCDate(form.WEnded
<CFDIRECTORY DIRECTORY="#Session.MTSDir
<CFOUTPUT QUERY="GetMTS">
<CFIF DateAdd("d",-2,#GetMTS.Dat
<CFFILE ACTION="Read"
FILE="#Session.MTSDir#\#fo
VARIABLE=MyFile>
etc etc
Your code works, but I cannot see why mine doesn't. What am I doing wrong?