date function fix for ESC