-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Covert to 24 hours time formate #2959
Comments
moment("02:00 PM", "h:mm A").format("HH:mm") // "14:00" |
Also note that you might not need moment.js at all, as there is an option for 24-hour format in that plugin. See the |
thank you very much @mj1856 . It's working |
How to use moment.js durations rightly? You need to import moment and moment-duration-format, firstly.
Then, use duration function. Let us apply the above example: 28800 = 8 am.
🎉Well, you do not have above type error. 🤔Do you get a right value 8:00 am ? No…, the value you get is 8:00 a. Moment.js format is not working as it is supposed. 💡The solution is that transform seconds to milliseconds and use UTC time.
All right we get 8:00 am now. If you want 8 am instead of 8:00 am for integral time, we need to do RegExp
IF YOU NEED MORE HELP COMMENT HERE..! THANK YOU |
var start_time = $('.start_time').val();
this will return time like 02:00 PM
How can I convert it 24 hours time format using moment js. I used this plugin to show time.
The text was updated successfully, but these errors were encountered: