gpt4 book ai didi

javascript - 如何使用 moment JS 从月份选择器获取上个月和预期格式

转载 作者:行者123 更新时间:2023-11-30 11:30:04 30 4
gpt4 key购买 nike

我正在使用 jquery.ui.monthpicker 库。对于月份选择器,我得到的日期如 07/2017。根据这个日期字符串,我需要计算上个月,并使用 moment js 格式化为 1707图书馆。

如有任何帮助,我们将不胜感激。

enter image description here

最佳答案

此代码可能会解决您的问题。

moment("07/2017", "MM/YYYY").subtract(1, 'months').format('YYMM');

关于javascript - 如何使用 moment JS 从月份选择器获取上个月和预期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46580319/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com