fix calling datetime function