You use quotes basically when you need a variables as a string. in your example, if you never used quotes for $(#date) it would not be treated as a string. it would just be a date like this: 2015/12/28 , but when you use quotes (' ') , it is converted to a string like this:'2015/12/28'
$ is used to evaluate the expression in the variable :
Check these articles for deeper insights on $ expansion:
'#' before a variable is used (I have not seen much of use cases) if the variable is meant to be evaluated as numeric value. For dollar ($) you have got references to be followed above, the single line highlight here could be
a dollar expansion is something that is done before the expression (or statement) is evaluated.
Single quotes are used when we compare strings. For better understanding and knowledge, read: QlikView Quoteology