moment show time code example

Example 1: moment format

moment().format('MMMM Do YYYY, h:mm:ss a'); // September 30th 2020, 2:48:17 pm
moment().format('dddd');                    // Wednesday
moment().format("MMM Do YY");               // Sep 30th 20
moment().format('YYYY [escaped] YYYY');     // 2020 escaped 2020
moment().format();                          // 2020-09-30T14:48:17+02:00

Example 2: convert unix timestamp to date using moment

var dateString = moment.unix(value).format("MM/DD/YYYY");

Example 3: moment set time

const date = "2017-03-13";
const time = "18:00";

const timeAndDate = moment(date + ' ' + time);

console.log(timeAndDate);