moment js add day
var new_date = moment(startdate, "DD-MM-YYYY").add(5, 'days');
moment js add day
var new_date = moment(startdate, "DD-MM-YYYY").add(5, 'days');
moment check valid date
var date = moment("2016-10-19");
var check = date.isValid();
console.log(check);
javascript get time ago with moment
const dateTimeAgo = moment("2020-04-04 11:45:26.123").fromNow();
console.log(dateTimeAgo); //> 6 minutes ago
moment format heure
var time = "15:30:00";
var formatted = moment(time, "HH:mm:ss").format("LT");
console.log(formatted);
//it will return 3:30 PM
moment.js get time from now
moment("20111031", "YYYYMMDD").fromNow(); // 10 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 9 years ago
moment().startOf('day').fromNow(); // 15 hours ago
moment().endOf('day').fromNow(); // in 9 hours
moment().startOf('hour').fromNow(); // an hour ago
how to get current time using moment
var startDate = moment().subtract(1, 'days'); //one day before the current time
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us