Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在Rails中获取下个月的最后日期_Ruby On Rails - Fatal编程技术网

Ruby on rails 如何在Rails中获取下个月的最后日期

Ruby on rails 如何在Rails中获取下个月的最后日期,ruby-on-rails,Ruby On Rails,我需要知道下个月的最后一天。 我试过了,但没发现 示例:日期。今天。月底。下个月使用 (Date.today + 1.month).end_of_month 仅在导轨中或具有主动支持的导轨中: (Date.today + 1.month).end_of_month 或者随着时间的推移: 1.month.from_now.end_of_month 我不认为在普通Ruby中可以做到这一点,但请查看Rails活动支持:试试这个(Date.today+1.month)。月底@MitchWheat这

我需要知道下个月的最后一天。 我试过了,但没发现

示例:
日期。今天。月底。下个月使用

(Date.today + 1.month).end_of_month

仅在
导轨中
或具有
主动支持的导轨中

(Date.today + 1.month).end_of_month
或者随着时间的推移:

1.month.from_now.end_of_month

我不认为在普通Ruby中可以做到这一点,但请查看Rails活动支持:试试这个
(Date.today+1.month)。月底
@MitchWheat这是什么意思?我尝试使用现有的rubymethods@Monk_Code谢谢,它起作用了
Date.today.next_month.end_of_month