Ily*_*lya 2 datetime elixir ecto phoenix-framework
我已经搜索了Ecto.DateTime,但是不幸的是没有找到任何有用的东西。有没有办法获得每月的最后一天?
我有一个查询,我从昨天(7月31日)到今天(8月1日)从psql加载订单,今天我只使用1,但是对于昨天,它可以是31、30、29或28。有没有办法知道上个月有多少天? 在此先感谢,任何建议表示赞赏!还有:calendar.last_day_of_the_month/2,它接受一个年份和月份作为参数。
iex(1)> :calendar.last_day_of_the_month(2000, 2)
29
iex(2)> :calendar.last_day_of_the_month(2001, 2)
28
Run Code Online (Sandbox Code Playgroud)
last_day_of_the_month(年,月)-> LastDay
类型:
Run Code Online (Sandbox Code Playgroud)Year = year() Month = month() LastDay = ldom()计算一个月中的天数。