Error with Date cmd

Hi all,

When i execute the below command its giving an error "date: Bad conversion"

date \"+DATE %m/%d/%Y HEURE %H:%M:%S\"

Off hand, the backslashes in front of the quotation marks look wrong. Does it help if you take those out?

OR

use single quotes.

Yes; if you want literal double quotes in the output, then it makes sense:

vnix$ date +'"DATE %m/%d/%Y HEURE %H:%M:%S"'
"DATE 05/19/2008 HEURE 11:38:45"

Or equivalently, add proper double quotes, and make sure the plus comes first:

vnix$ date +"\"DATE %m/%d/%Y HEURE %H:%M:%S\""
"DATE 05/19/2008 HEURE 11:39:54"

You might want to read UNIX Shell Quote

I think its better to use single quotes for all situations where you don't require something to be interpolated by the shell.