Converting the format of a date

The Date plus/minus days logic can be used to convert a date from one format to another.

For example if you want to convert a date from YYYY-MM-DD to DD/MM/YYYY or alternatively from the format DD/MM/YYYY to YYYY-MM-DD.

Converting a date

  1. From the Advanced > Logic page in the control centre for the form, click the Add Logic button.

    advanced-logic-tab

  2. Give the logic a name.

    logic-name

  3. Select the type Predefined.

    logic-type

  4. Choose the Date plus/minus days formula from the drop down list

    logic-formula

    In the next step you're going to need to understand the format of the date is orginally in. It may not be in the format you expect. See common date formats used in XFP if you are unsure.

  5. Set the Date to change input to date you want to convert.

    date-to-change-input

  6. Set the input format. See understanding date formats for information on the different date formats.

    input-format

  7. Select the desired output format. See understanding date formats for information on the different date formats.

    output-format

  8. Set the +/- input to either plus or minus (it makes no difference when converting a date)

    plus-minus

  9. Set the Amount input to 0.

    amount

  10. Set the Weekdays or Days input to either Weekdays or Days (it makes no difference when converting a date)

    weekdays-or-days

  11. Save the logic. Use the result of the new logic in form templates, other logics and content.

Example

An example showing the conversion of a date from a Date question (YYYY-MM-DD format) into a user friendly format DD/MM/YYYY.

complete-example

results matching ""

    No results matching ""