How to get only a year from the DateTime tool?

  • Profile Image
    Asked on January 28, 2015 at 10:10 AM
    I also need to use just the year from a date field in another calculation.
  • Profile Image
    Answered on January 28, 2015 at 11:16 AM

    I see that you wish to use only a "year" for your Date.

    Is that the increment and range allotment that you wanted? Or what exactly do you mean by that?

    To do yearly increments I would actually recommend using our Birth Date Picker Widget because it is more intended for this sort of thing and includes options for the date range

    If you don't wanna do that then please explain more so that we can try to help you more with what you are trying to do.

  • Profile Image
    Answered on January 28, 2015 at 11:19 AM

    Pardon, I realized after I posted my above answer that maybe you just wanted to limit this to just the dates within a year. 

    Is that maybe what you meant instead? 

    Could you please confirm or correct me if needed and we'll help you further with this.

  • Profile Image
    Answered on January 28, 2015 at 11:35 AM

    I use the year in a calculation.  I have a version of the form entering the current year manually, but I don't want people to be able to adjust this or see that it is there... so I want to just grab the current year... and I was thinking I could do that by creating a date field defaulted to today and having it hidden...

    That gives the current date... but I just want the year portion.

    It will be collpsed... so need it in number format.

    Above is the form so you can see the calc if I enter the year.

    In the end all will be hidden other than birth month and day.

  • Profile Image
    Answered on January 28, 2015 at 11:59 AM

    Thank you for the additional details to help us understand more about what you wanted. I'll need some time to see if I can figure out something better for your needs with this then.

  • Profile Image
    Answered on January 28, 2015 at 12:08 PM

    Something that I remembered is which I think would help you with this problem would be for you to mark the Input and also the DateTime Field that you wanted as "Read-Only".

    Setting this to "Yes" disables the option for the user so that they can't change it on certain fields.


  • Profile Image
    Answered on January 28, 2015 at 12:49 PM

    I have a read only field that is hidden with today's date.

    I have a form that has all of the calculations in it using a manually entered current year.

    I just want to be able to swap that out in calculations with the current year from today's date that I have captured above.

    Couldn't tell if you were still working on this part as I don't think I see it answered.

  • Profile Image
    Answered on January 28, 2015 at 01:57 PM


    You can setup a condition to update your "Enter year" field, based on the current date field.  Here is the condition I set up:

    Then I set the "Enter Current Year" field to read only.  I also set up a similar condition for 2016 except using "After" rather than "Before" in the condition.

    Here is my test form to show you it working:

    Let us know if this is not what you were looking for and we will be happy to see what else we can do.