Answers for "moment format date time"

4

date format in moment js

moment().format('MMMM Do YYYY, h:mm:ss a'); // April 14th 2021, 5:38:08 pm
moment().format('dddd');                    // Wednesday
moment().format("MMM Do YY");               // Apr 14th 21
moment().format('YYYY [escaped] YYYY');     // 2021 escaped 2021
moment().format();                          // 2021-04-14T17:38:08+06:00
Posted by: Guest on April-14-2021
2

moment hour minute

moment().format('HH:mm:ss')
Posted by: Guest on January-12-2021
3

moment js date diff

var now  = "04/09/2013 15:00:00";
var then = "02/09/2013 14:20:30";

var ms = moment(now,"DD/MM/YYYY HH:mm:ss").diff(moment(then,"DD/MM/YYYY HH:mm:ss"));
var d = moment.duration(ms);
var s = d.format("hh:mm:ss");

// outputs: "48:39:30"
Posted by: Guest on July-01-2020
2

moment add seconds

var travelTime = moment().add(642, 'seconds').format('hh:mm A');// it will add 642 seconds in the current time and will give time in 03:35 PM format

var travelTime = moment().add(11, 'minutes').format('hh:mm A');// it will add 11 mins in the current time and will give time in 03:35 PM format; can use m or minutes 

var travelTime = moment().add(2, 'hours').format('hh:mm A');// it will add 2 hours in the current time and will give time in 03:35 PM format
Posted by: Guest on March-03-2020
-1

moment now format

var date = moment().format('MM/DD/YYYY');
Posted by: Guest on July-27-2020
8

format a date moment

moment(testDate).format('MM/DD/YYYY');
Posted by: Guest on December-18-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language