Hoppa till huvudinnehållet

Kommentarer

4 kommentarer

  • Officiell kommentar
    Ryan Cooney

    I would use:

    =(new Date()).getFullYear()

  • Bill Warren

    Try the Format Date activity.  The Date input is  =Date.now().  Choose whatever format you need.  You can then create a value from the result.  In my case, I use the LL format and to get the current year # I create a value with the expression - =parseInt($date.formatted.substr($date.formatted.length -4))  where “date” is the ID of the Format Date activity.

    1
  • Luc

    Thank you Bill. This worked for me.  

    0
  • Berend Veldkamp

    Note that $date.formatted may depend on the user's locale, so Bill's solution will only work if the year is the last part of the formatted value. Ryan's solution will always work.

    If you still prefer Format Date, I'd use $date.iso.substring(0,4) . Also, substr() is deprecated, use substring() instead.

    1

Du måste logga in om du vill lämna en kommentar.