I have string accessDate = 20.11.2018 17:28, how to convert this date to unix timestamp by moment, im trying like this - moment(accessDate).unix(), nothing happen, but when im using moment().unix() everything all right
CodePudding user response:
You need to specify the format you are importing the date as. This code is untested but for your case:
moment(accessDate, "DD.MM.YYYY h:mm").unix();
You can find more information here.