Not all javascript engines have Date.strftime().

So implement our own simple version of it.
Fix some longstanding bugs in pivot=, and add unit tests for it.

In particular, when a T_DATE ended up as a column heading, it was being
rendered in the (totally ugly) default javascript notation instead of using
our prettier string representation.

It also didn't work to use the same column name in two different aggregates,
for example, pivot=a;b;min(c),max(c).  They would both end up showing the
value of min(c).
Add median and stddev aggregate functions.