Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

moment today date

moment().format('YYYY-MM-DD')
Comment

Get current date in javascript using moment()

// using moment()
var now	= moment();
let today = now.format('YYYY-MM-DD');
Comment

moment is today

moment().isSame('2022-06-28', 'day');
Comment

how to get today in moment js

// call this function, passing-in your date
function dateToFromNowDaily( myDate ) {

    // get from-now for this date
    var fromNow = moment( myDate ).fromNow();

    // ensure the date is displayed with today and yesterday
    return moment( myDate ).calendar( null, {
        // when the date is closer, specify custom values
        lastWeek: '[Last] dddd',
        lastDay:  '[Yesterday]',
        sameDay:  '[Today]',
        nextDay:  '[Tomorrow]',
        nextWeek: 'dddd',
        // when the date is further away, use from-now functionality             
        sameElse: function () {
            return "[" + fromNow + "]";
        }
    });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: import file in chrome extension 
Javascript :: javascript seconds after input 
Javascript :: set function to execute at certain time js 
Javascript :: js regex find text inside single quotes 
Javascript :: news api react native 
Javascript :: install node specific version ubuntu 
Javascript :: recursive function javascript 
Javascript :: nodejs mysql connection 
Javascript :: how to draw a flower in javascript 
Javascript :: how to combine two regular expressions in javascript 
Javascript :: How do I access a class without an instance? +javascript 
Javascript :: count number of times an element is occuring in an array in javascript 
Javascript :: chart-js-2 
Javascript :: ejemplo async await javascript 
Javascript :: react native layout animation android 
Javascript :: side effect, useEffect, return 
Javascript :: dataset javascript 
Javascript :: js get html title 
Javascript :: javascript string reverse 
Javascript :: github create react app buildpack 
Javascript :: flatlist react native keyextractor 
Javascript :: canvas setup 
Javascript :: math module js 
Javascript :: caching in javascript 
Javascript :: js create a auto call function inside function 
Javascript :: javascript getter arrow function 
Javascript :: regex check for anchor tag with specific text 
Javascript :: how to change string to array in javascript 
Javascript :: crypto js 
Javascript :: React Native drawer navigation screen header title and buttons 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =