0

How to use code to calculate the number of days in this year or next year?

Thank you for reply.

6 replies

null
    • Fred
    • 2 mths ago
    • Reported - view

    Can you be more specific?

      • gold_cat
      • 2 mths ago
      • Reported - view

      I just want to get the number of days in this year, either 365 or 364. I tried using "day(), month(), year(), today()...", but I have no idea. 

      • Fred
      • 2 mths ago
      • Reported - view

      Do you want to know the number of days left in the year from today? You can try something like:

      days(today(), date(2024, 12, 31))
      

      If you don't want to hard code ending date then you can create a new date field and use that as your end date.

      newfield called yearEnd
      
      change to formula:
      days(today(), yearEnd)
      

      If that is not what you want, then maybe please explain what you need this for.

      • Alain_Fontaine
      • 2 mths ago
      • Reported - view

       I suppose that you mean 365 or 366…

      let y := year(today());
      days(date(y, 1, 1), date(y, 12, 31)) + 1
      
      • gold_cat
      • 2 mths ago
      • Reported - view

       Thank you, this is the answer I wanted.

      • gold_cat
      • 2 mths ago
      • Reported - view

       Thank you, this is the answer I wanted too.

Content aside

  • Status Answered
  • 2 mths agoLast active
  • 6Replies
  • 33Views
  • 3 Following