moment获取前一天时间
时间: 2024-01-13 18:04:29 浏览: 145
用moment.js 获取当前时间源码.zip
要使用Moment.js获取前一天的时间,可以使用以下代码:
moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss')
这将返回当前时间的前一天的日期和时间。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [moment()获取当前时间的前几个小时、前几天、前几个月、前几年](https://blog.csdn.net/Liberal_w/article/details/128496494)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [用moment.js 获取当前时间源码.zip](https://download.csdn.net/download/liufang_imei/87554677)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文