What is the appropriate way to get the current time on the machine? Var olddate = new date (), momentobj = moment. I'm able to get the difference between two dates using momentjs as follows:
Cruella Biography, Wiki, Age, Net Worth, Boyfriend
I read most of their docs, but. Moment (end.diff (starttime)).format (m [m] s [s]) however, i also want to display the hour when applicable (only. Thus your diff is being computed on which day of the week, which has to be between 1 and 7.
I can't get the correct date.
You probably don't need moment.js anymore moment is great time manipulation library but it's considered as a legacy project, and the team is recommending to use other libraries. I'm using moment.js to format my date time, here i have two date values, and i want to achieve a particular function when one date is greater than the other. Change the language of moment.js by using the locale method to set or get the desired language. Format('e') stands for day of week.
Sorry to jump in so late, but if you want to remove the time portion of a moment() rather than formatting it, then the code is: Vs var currentdate = moment().format();. Using moment.js i can't transform a correct moment object to a date object with timezones. I am trying to understand the momentjs api.