Skip to content
Advertisement

Tag: datetime

Only retrieve YYYY-MM-DD from moment

Doing moment().format() returns 2018-05-30T11:38:04+10:00. How can I retrieve only the 2018-05-30 part of it? Answer Here you go. You need to pass format string in moment().format(“you desired date/time format in string format”) function For more information, checkout this link for formatting : https://momentjs.com/docs/#/parsing/string-format/

How to manage datetime in angular

I’m working with Angular(v5). I have some problem with Datetime. I need the current time and I have to save it in a variable. After that I have to subtract an interval of hours (8 hours or an hour) and save the result in a variable and then do it withconsole.log. I need the format to be: YYYY-MM-DD HH:mm:ss I

Adding minutes to datetime in momentjs

I need to add the variable secondsToMinutes to the startdate. secondsToMinutes is “3:20” startDate = “2:00 PM” endDate should equal “2:03:20 PM”. I’ve tried a number of ways and get errors each and every time. Date shows up as invalid date. Answer moment().format(“LTS”) returns a string value in hh:mm:ss AM/PM format. When you create a moment object using a string

How to compare two Moment.js Objects

I have an Array with Moment.js objects in a variable: And a function to determinate if a value is in this array: But even if i pass a moment object, as checkFeriado(moment(“2016-01-01”)); i’m getting false. Whats wrong with my code? Is there a best way to do this? Entire project have jQuery and Moment.js Answer Javascript objects cannot be compared

How to parse given date string using moment.js?

I want the following date string to be formatted using moment.js but it gives invalid date. How to parse it correctly or is there any other way to do so? Answer Just use pattern as second parameter in moment function more here in the docs: http://momentjs.com/docs/#/parsing/string-format/

Advertisement