为什么当我从 Dynamics CRM 中的日期字段获取月份和日期值时,它是月份和日期 - 1?
Why when i get the month and day value from a date field in Dynamics CRM it is the Month and Day - 1?
我在 CRM 中显示了一些奇怪的日期值。我正在使用 javascript 应用快速修复,将字段的日期时间设置为中午 12 点的日期。
为什么在获取月份和日期值时,调试器显示月份和日期 - 1,如下所示?
date.getMonth()
returns 月份为 0 到 11 之间的数字,因此一月为 0,十二月为 11。
date.getDay()
returns 星期几,其中星期日为 0,星期一为 1,依此类推。
如果你想得到这个月的第几天,你必须调用date.getDate()
。
我在 CRM 中显示了一些奇怪的日期值。我正在使用 javascript 应用快速修复,将字段的日期时间设置为中午 12 点的日期。
为什么在获取月份和日期值时,调试器显示月份和日期 - 1,如下所示?
date.getMonth()
returns 月份为 0 到 11 之间的数字,因此一月为 0,十二月为 11。
date.getDay()
returns 星期几,其中星期日为 0,星期一为 1,依此类推。
如果你想得到这个月的第几天,你必须调用date.getDate()
。