Monday, September 8, 2008

Passing Date Object to CF

I must preface my first post with this disclaimer:
I am not a programmer, I just play one online.

While building my second Flex app, I had a problem passing the date object to coldfusion with HTTPservice. It passed fine when I left it alone, but when I tried to format it with CF using DateFormat, it gave me the year 2000 instead of 2008.

After a bit of trial and error, I found that if I change the date to a string in Flex, then I can format it using DateFormat in CF.

So in Flex:
var myDate:String = myDate.selectedDate as String;

And in CF:
#DateFormat(myDate, "mmm dd, yyyy")#

I would really like to know why it works this way, so if any of you "programmers" out there can shed some light on it, I would be most appreciative.

No comments: