从时刻js对象中提取时间 [英] Extract time from moment js object

查看:185
本文介绍了从时刻js对象中提取时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用moment.js提取时间?

How do i extract the time using moment.js?

"2015-01-16T12:00:00"

它应该返回12:00:00 pm。
字符串返回将传递给下面的timepicker控件。

It should return "12:00:00 pm". The string return will be passed to the timepicker control below.

http://jdewit.github.com/bootstrap-timepicker 

有什么想法吗?

推荐答案

如果您阅读了文档( http://momentjs.com/docs/#/displaying/ )您可以找到以下格式:

If you read the docs (http://momentjs.com/docs/#/displaying/) you can find this format:

moment("2015-01-16T12:00:00").format("hh:mm:ss a")

请参阅JS Fiddle http://jsfiddle.net/Bjolja/6mn32xhu/

See JS Fiddle http://jsfiddle.net/Bjolja/6mn32xhu/

这篇关于从时刻js对象中提取时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆