It is most likely a formatting problem. Your date is coming back from the database as a fully formatted timestamp. You can try a few options and see which one works:
1. Try to simply convert the incoming date into a number:
Let vVersionDate = num(peek('VERSION_DATE',0,VERSIONDATE) );
2. If that doesn't work, then try to convert the full timestamp string into a date field, and then convert it into a number:
Let vVersionDate =
'M/D/YYYY hh:mm:ss TT'
Check out my book QlikView Your Business - now available to pre-order on Amazon!
The peek() seems to be working already, maybe only once in a while.
However, if vVersionDate contains 2/7/2015 12:00:00 AM, then simply using the variable value as a parameter to the date() function will produce an illegal script expression, like date(2/7/2015 12:00:00 AM) as VERSION_DT. QlikView cannot correctly interprete the parameter.
Again, use quotes to turn the value into a string which QlikView will be able to handle. Like
date('$(vVersionDate)') AS VERSION_DT,