moment.js concatenate date and time

Concatenate the date and time strings and parse them as one, e.g.

var date="23/02/2017";
var time="15:42";

var dateTime = moment(date + ' ' + time, 'DD/MM/YYYY HH:mm');

console.log(dateTime.format('YYYY-MM-DD HH:mm'))
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.js"></script>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)