DATE/TIME variable defaulted to 1st and last day of the month

datetime
already-implemented

(Phany) #1

Could you be kind and assist me in the following

  • Would like to create a Date/Time variable called Survey_Date but consisting only of Year and Month; note that it must not be a String. Just Date Format excluding Day;
  • How can I create a DATE VARIABLE defaulting system date to 1st of every month and another one defaulting to last day of the month

(Jeanbernard) #2

Hi phany,
I don’t know if it will be helpful but check this link:
https://support.mysurvey.solutions/syntax-guide/syntax-guide-date-questions/

Check under the heading CenturyMonthCode.


(Misha) #3

This request belongs to Feature Suggestion.
Currently, there is no direct way to implement what you are asking. However, #2 is on our short list of features that will be implemented in the next 2 - 3 releases.
As a workaround for #1 I might suggest a combination of a numeric question for the year and single select categorical question with 12 categories for months.


(Sergiy Radyakin) #4

jeanbernard points to a good solution: indeed the century-month codes were designed exactly for the reason that you can avoid specifying the full date in the case when the day is not known, which is sufficient for many situations, such as measuring the age of a child in months for the z-score functions, and other similar applications.

CenturyMonthCode(month, year) - computes the century month code based on the month and the year.

Note that while you can calculate a century month code conveniently with this function, entry is not as convenient since there is no corresponding question type for it.

Still see if the example section “Calculate child age in months” in “Public example User questions and common patterns” is delivering the desired experience.

https://designer.mysurvey.solutions/questionnaire/details/04b421596f0443e88cd99ec0538d89ff/chapter/80ee69ac968326477ffdf2b244d98d81/group/80ee69ac968326477ffdf2b244d98d81

Best, Sergiy Radyakn