Body: <p>I am currently trying to find the number of days between the current date and the case start date using searchkit. I have tried the &quot;Date between two dates&quot; function on Searchkit, however it does not allow me to choose for current date.</p>
  <p>I have also tried the &quot;Rewrite&quot; function on Searchkit with the following code:
  {'[Contact_CaseContact_Case_01.start_date]'|smarty_modifier_datediff start_date='[CURDATE()]'}
  However, seems like the Smarty tokens does not work. Could anyone help me with this?</p>
  <p><a href="https://i.sstatic.net/HJf3A.png" rel="noreferrer"><img src="https://i.sstatic.net/HJf3A.png" alt="Screenshot of the Rewrite code to calculate number of days" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-01T14:38:01.070Z
Comments.Text: I believe I have solve this issue. Leaving the code here in case anyone needs it in the future: {capture assign=time_in}{'[DATE_created_date]'|date_format:'%s'}{/capture}
  {capture assign=time_out}{'$smarty.now'|date_format:'%s'}{/capture}
  {math equation="ceil((y-x)/(60*60*24))" y=$time_out x=$time_in} days
Comments.UserDisplayName: Cas
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-01T19:56:09.907Z
Comments.Text: Well done. if you have enough reputation you should be able to paste the above as an Answer, which then helps close off this issue.
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-02T03:49:53.840Z
Comments.Text: Yes good job sticking with it. It will work for current php versions just note smarty date_format is deprecated because it uses strftime which is deprecated in php, so will eventually stop working. There have been a few discussions as to what to do about this, in particular with search kit since it also depends on your date format prefs as to whether it can parse it properly. Example chat: https://chat.civicrm.org/civicrm/pl/qif3rus3sfgwjrmns4wkmhf4bo
Comments.UserDisplayName: Demerit
Tags: <tokens><searchkit><smarty>
Title: Calculating the difference between current date and case start date on searchkit
ThreadText: # Calculating the difference between current date and case start date on searchkit
  
  (Asked by: username_0 on 2023-08-01)
  
  I am currently trying to find the number of days between the current date and the case start date using searchkit. I have tried the "Date between two dates" function on Searchkit, however it does not allow me to choose for current date.
  
  I have also tried the "Rewrite" function on Searchkit with the following code:
  {'[Contact\_username_0eContact\_username_0e\_01.start\_date]'|smarty\_modifier\_datediff start\_date='[CURDATE()]'}
  However, seems like the Smarty tokens does not work. Could anyone help me with this?
  
  [![Screenshot of the Rewrite code to calculate number of days](https://i.sstatic.net/HJf3A.png)](https://i.sstatic.net/HJf3A.png)
  
  **Tags:** tokens, searchkit, smarty
  
  > **Comments:**
  > **username_0**: I believe I have solve this issue. Leaving the code here in case anyone needs it in the future: {capture assign=time_in}{'[DATE_created_date]'|date_format:'%s'}{/capture} {capture assign=time_out}{'$smarty.now'|date_format:'%s'}{/capture} {math equation="ceil((y-x)/(60*60*24))" y=$time_out x=$time_in} days  
  > **username_1**: Well done. if you have enough reputation you should be able to paste the above as an Answer, which then helps close off this issue.  
  > **username_2**: Yes good job sticking with it. It will work for current php versions just note smarty date_format is deprecated because it uses strftime which is deprecated in php, so will eventually stop working. There have been a few discussions as to what to do about this, in particular with search kit since it also depends on your date format prefs as to whether it can parse it properly. Example chat: https://chat.civicrm.org/civicrm/pl/qif3rus3sfgwjrmns4wkmhf4bo  
  
  ---
  
  ## 0 answers
  
  