assume datestr to be the same as dateval which is not technically correct.