tweaked date function