Problem in date format conversion using javascript

Hello,
I am getting the current date using get system info step and want to convert it into different format. but it is giving the error if I use str2date function. (See Snapshot)

In Question it is mentioned that (Maintain its DataType as Date).
I can make date into different format by extracting Date ,month , Year individually and concat them later into particluar format.
but in question it asked for Maintain DataType as Date.

Please use date2str(Todays_date, “dd-MM-yyyy”) instead of str2date(Todays_date, “dd-mm-yyyy”);

date2str function is working. I think Because of its datatype object I was not able to convert using str2date.