moment.js 算当天时间差
时间: 2024-01-25 12:36:29 浏览: 83
要计算当天时间差,可以使用Moment.js库中的`moment().startOf('day')`方法。这个方法可以将当前时间设为当天的开始时间,然后再用`moment().diff(moment().startOf('day'), 'milliseconds')`方法计算当前时间和当天开始时间的时间差,单位为毫秒。这样就可以得到当天的时间差了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [moment.js使用](https://blog.csdn.net/qq_53689264/article/details/131207555)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [moment.js时间加减处理](https://blog.csdn.net/qq_27674439/article/details/117708915)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [moment.js 常用用法及时区转换](https://blog.csdn.net/weixin_45941959/article/details/122673582)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文