Convert date in dd mm yyyy format to UNIX timestamp

Hello All,

I have a date in DD/MM/YYYY format. I am trying to convert this into unix timestamp. I have tried following:

date -d $mydate +%s

where mydate = 23/12/2016 00:00:00

I am getting following error:

date: extra operand `+%s'
Try `date --help' for more information.

Please advise.

Thanks
Angshuman

The date string has spaces in it. Surround the mydate variable with spaces.
Note that the order you have for elements of the date string ( %d/%m/%Y %H:%M:%S )
may require a locale change to work correctly

date -d "$mydate" +%s

Because of my locale to test this I had to rewrite the string to:

%m/%d/%Y %H:%M:%S
12/23/2016 00:00:00