Answers.Body: <p>I believe: <code>{{ now | date_modify('-1 month') | date('t') }}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-24T14:58:26.397Z
Answers.LastActivityDate: 2017-07-24T14:58:26.397Z
Answers.UserDisplayName: Matt Wilcox
Body: <p>I am working on a calendar, and so far I know how to get the number of days in the current month.
  <code>{% set daysInMonth = time|date('t') %}</code></p>
  
  <p>But how can I get the number of days in the previous month? </p>
  
  <p>Thanks in advance. </p>
  
Tags: <templating><datetime><calendar>
Title: How do I get the number of days in the previous month?
ThreadText: # How do I get the number of days in the previous month?
  
  (Asked by: username_0 on 2017-07-24)
  
  I am working on a calendar, and so far I know how to get the number of days in the current month.
  `{% set daysInMonth = time|date('t') %}`
  
  But how can I get the number of days in the previous month?
  
  Thanks in advance.
  
  **Tags:** templating, datetime, calendar
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-24. Score: 2 | Accepted answer
  
  I believe: `{{ now | date_modify('-1 month') | date('t') }}`
  
  
  ---
  
  