Error message: "getFullYear() is not a function". What is the correct function to get year from date/time field?

  • 1
  • Problem
  • Updated 4 years ago
  • Not a Problem
I set this var

var InstallYear=InstallDate.getFullYear(); 

and I get this error

getFullYear() is not a function

what is the correct function to get the year from a date/time field?
Photo of Anna Orias

Anna Orias

  • 1,508 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,828 Points 20k badge 2x thumb
Do you need to do this in Javascript? 

You could create UI Only field and use the "Year" function. 

If you need to hang out in Javascript - you will probably need to convert the SF date to a JS date.  Look for the skuid utility API:  parseSFDate( sfDate )