fix function datestr