Fix date function in tools