How to display the currently selected month as a string?

  • Profile Image
    Avertical
    Asked on August 27, 2015 at 08:45 AM

    Hello,

     

    I am trying to get my form to have a field to display only the current month that will automatically update based on current date prepopulated from the date field. Isn't the purpose of the date() function to transform a string into a longford date? This is what the example text shows. Below is the form that I'm working on.

     

     

     

    Thank you,

    Alfredo

  • Profile Image
    Ben
    Answered on August 27, 2015 at 12:26 PM

    I took a look at your form Alfredo, but I see that you were able to set it up so that only the month is shown, using the Substring widget.

    I am not quite sure what you mean by date() function not working correctly, but the date() function should actually return a date element that you can use based on the string that you provide in the form calculation or the conditions.

    To get the month, you can use:

    1. the option you have used above - Substring widget
    2. conditions to check which month it is and based on that to fill the field on the form with the right data.

    The conditions however require you to check if the date is between static dates which means that you would need to manually add the checks if date is before or after year-month-day.