Picture of Formatting date and time variables | FB_019

Formatting date and time variables | FB_019

Variables can be created to accept data in specified date and time formats, rather than simply the free input of text. When doing this, it is important to specify the exact required format for these inputs. When working with an entire field in your MegaEdit product, this is quite simple, however what happens if we need to apply that exact formatting when the date and time are input as variables within one field? This tutorial will walk us through this process. This tutorial assumes some prior knowledge in the configuration of fields and variables in the Infigo Form Builder.

Tutorial Video Transcript

A transcript of our tutorial video, ensuring you can find exactly what you need, when you need it.

You can search this page to find the relevant time-stamp in the video. Also, this text can be used as part of the tutorial search feature.

00:00:05:15 - 00:00:07:01
Variables can be created to

00:00:07:01 - 00:00:11:06
accept data
in specified date and time formats

00:00:11:09 - 00:00:14:28
rather than simply
just allowing the free input of text.

00:00:15:00 - 00:00:17:21
When doing this, it's important
to specify the exact

00:00:17:21 - 00:00:21:20
required format for those inputs.

00:00:21:23 - 00:00:23:16
When working with an entire field

00:00:23:16 - 00:00:26:17
in your MegaEdit product such as the one
we've got on the screen at the moment.

00:00:26:24 - 00:00:28:21
This is quite simple.

00:00:28:21 - 00:00:31:14
So you see that we've specified it
as a date format

00:00:31:14 - 00:00:35:14
and then we have the ability to specify
the formats that date is going to take.

00:00:35:17 - 00:00:39:27
And then when you look at it on the form,
it appears as a date picker.

00:00:40:00 - 00:00:44:15
Similar process
with a time field as specified as time.

00:00:44:18 - 00:00:48:00
We can put in some basic specifications
of what time it will allow.

00:00:48:02 - 00:00:49:10
Then it appears on our form.

00:00:49:10 - 00:00:52:29
But what happens
if we need to apply that exact formatting

00:00:53:02 - 00:00:58:01
when the date and time
are input as variables within one field?

00:00:58:04 - 00:01:01:13
So we still want the same functionality
of the form

00:01:01:13 - 00:01:04:17
entries like this,
but they're no longer separate fields.

00:01:04:17 - 00:01:08:28
They're now included as variables
in one solitary field.

00:01:09:01 - 00:01:14:13
So this tutorial will walk us through the
process of configuring and applying that.

00:01:14:15 - 00:01:17:20
Now this tutorial assumes
some prior knowledge in the configuration

00:01:17:20 - 00:01:24:02
of fields and variables
in the Infigo form builder.

00:01:24:04 - 00:01:25:19
So this is my starting point.

00:01:25:19 - 00:01:27:25
So you see we've done a bit of work
previously.

00:01:27:25 - 00:01:30:05
Following instructions from other Infigo.

00:01:30:05 - 00:01:33:15
Academy tutorials create and configure
a couple of basic

00:01:33:15 - 00:01:36:22
variables within the script config.

00:01:36:24 - 00:01:40:27
There's something like this
with not much specification at the moment

00:01:40:29 - 00:01:45:01
and then once done, base
those variables into a single text

00:01:45:01 - 00:01:51:01
field on your MegaEdit canvas.

00:01:51:03 - 00:01:54:17
Now as mentioned,
I have a fully configured date and time

00:01:54:24 - 00:01:58:10
field set here, so two individual fields.

00:01:58:13 - 00:02:03:09
The easiest way to actually obtain the
correct format of tag for your variables

00:02:03:11 - 00:02:07:09
is to utilize
an entire field dedicated to the date

00:02:07:16 - 00:02:11:21
or time formats.

00:02:11:23 - 00:02:14:08
If I click on the date field,
for example, and starts

00:02:14:08 - 00:02:22:22
changing this formatting
of our required date,

00:02:22:25 - 00:02:24:13
as you change the date format,

00:02:24:13 - 00:02:29:04
a field tag will be created
detailing that required format.

00:02:29:06 - 00:02:33:06
Now what we want to do is copy down
this information as will input this later

00:02:33:06 - 00:02:37:16
on into our variable.

00:02:37:18 - 00:02:38:09
We can repeat that

00:02:38:09 - 00:02:41:09
same process with a dedicated time field.

00:02:41:10 - 00:02:45:06
So if I click on my time field here,

00:02:45:09 - 00:02:48:09
change the format of the time
that is shown in this field

00:02:48:10 - 00:02:55:01
in order to create a relevant field tag.

00:02:55:04 - 00:02:57:20
And again, we just want to copy down
that field tag for later

00:02:57:20 - 00:03:05:23
use as we're going to utilize it
within our variable.

00:03:05:25 - 00:03:06:21
So with that information

00:03:06:21 - 00:03:10:18
done, I'm
going to navigate to our script config.

00:03:10:20 - 00:03:13:08
There's a couple of modifications
we need to make in here

00:03:13:08 - 00:03:18:00
to allow them
to utilize date and time formats.

00:03:18:02 - 00:03:18:22
Starting off with

00:03:18:22 - 00:03:22:15
the date example and the date variable.

00:03:22:17 - 00:03:26:03
The first thing we want to do is to modify
the input line

00:03:26:05 - 00:03:29:04
so mine is currently specified
as text field.

00:03:29:04 - 00:03:33:04
I want this to be a date field.

00:03:33:07 - 00:03:35:07
This will enable
the use of these additional

00:03:35:07 - 00:03:38:14
formatting tags.

00:03:38:16 - 00:03:40:19
And then we want to add a new line

00:03:40:19 - 00:03:45:15
to our variable configuration,
which is named tags.

00:03:45:18 - 00:03:48:01
So what we want to do here
is input the date field

00:03:48:01 - 00:03:51:29
tag information that we copied down,
ensuring the correct format.

00:03:51:29 - 00:03:54:10
So we'll see this in a moment.

00:03:54:10 - 00:03:58:05
So I need to make sure that
if I'm adding a new line this last line

00:03:58:05 - 00:04:02:07
of the configuration of that variable
does need a comma at the end,

00:04:02:09 - 00:04:03:17
then a new line.

00:04:03:17 - 00:04:10:05
And then we want to format this as tags

00:04:10:07 - 00:04:11:25
and then whatever we copy down

00:04:11:25 - 00:04:15:22
from our actual MegaEdit product.

00:04:15:25 - 00:04:17:16
That's what we're going to input in here.

00:04:17:16 - 00:04:21:28
So this is just one example.

00:04:22:01 - 00:04:24:23
Moving on to the time
variable, it's a very similar process.

00:04:24:23 - 00:04:30:03
We first need to modify the input line
and this is going to be a time field.

00:04:30:05 - 00:04:36:03
And again, this will enable the use
of these additional formatting text.

00:04:36:05 - 00:04:37:23
And again,
we're going to repeat the process

00:04:37:23 - 00:04:39:19
and put the additional tags line.

00:04:39:19 - 00:04:43:14
So first,
put the comma on the previous line,

00:04:43:16 - 00:04:48:02
then start creating our tags on.

00:04:48:05 - 00:04:49:21
So there's another example.

00:04:49:21 - 00:04:53:15
We'll go ahead and save that
just to make sure that it's utilized

00:04:53:18 - 00:04:57:06
and double check that it's not come up
with an error in the JSON format.

00:04:57:08 - 00:04:58:13
So there's no error come up.

00:04:58:13 - 00:05:02:21
So we know that is successful.
We've been able to save.

00:05:02:23 - 00:05:06:05
Now going
to go back to my MegaEdit product

00:05:06:08 - 00:05:17:10
and refresh it.

00:05:17:12 - 00:05:18:17
And we can see on our form

00:05:18:17 - 00:05:21:17
now that we have those variables
in action.

00:05:21:18 - 00:05:25:08
So I'm just going to delete
the actual date field and time fields

00:05:25:08 - 00:05:32:19
just so we can actually focus
on the ones that we've just made.

00:05:32:21 - 00:05:34:19
So you'll see within our variable field,

00:05:34:19 - 00:05:38:08
I have a date
tag example and our time tag example.

00:05:38:11 - 00:05:42:04
When I start making changes to these,
it will update the contents

00:05:42:10 - 00:05:46:19
of that one single field
with the two bits of variable information.

 

Incomplete
Step by Step Guide

Formatting date and time variables | FB_019

Variables can be created to accept data in specified date and time formats, rather than simply the free input of text. When doing this, it is important to specify the exact required format for these inputs.

When working with an entire field in your MegaEdit product, this is quite simple, however what happens if we need to apply that exact formatting when the date and time are input as variables within one field?

This tutorial will walk us through this process.

This tutorial assumes some prior knowledge in the configuration of fields and variables in the Infigo Form Builder.

Creation Date: Feb 06, 2024
Created By: Sam Webster

1. Create your variables and input them into your MegaEdit product

Following instructions from other Academy tutorials, create and configure a couple of basic variables within the script config. Once done, place these variables into a text field on your MegaEdit canvas.

Create your variables and input them into your MegaEdit product

2. Utilise a date field to obtain the required tags

The easiest way to obtain the correct format of tag for your variable is actually by utilising an entire field dedicated to date input.

Utilise a date field to obtain the required tags

3. Change the date formatting to your required format

Change the date formatting to your required format

4. As you change the date format, a field tag will be created detailing that format. Copy down this information as we will later input it into our variable.

As you change the date format, a field tag will be created detailing that format. Copy down this information as we will later input it into our variable.

5. Repeat the process for a dedicated time field

Repeat the process for a dedicated time field

6. Change the format of the time shown in this field in order to create a relevant field tag

Change the format of the time shown in this field in order to create a relevant field tag

7. Copy this field tag down for later use, as we will use it in our variable

Copy this field tag down for later use, as we will use it in our variable

8. Navigate to your script config either on the product or global level (wherever you created the basic variables)

Navigate to your script config either on the product or global level (wherever you created the basic variables)

9. Modify the 'input' line

For a variable containing date information, input "DateField". This will enable the use of these additional formatting tags

Modify the 'input' line

10. Add a new line to your variable configuration named "tags". Input the Date field tag information you copied down, ensuring the correct format as seen here. tags: ['DateFieldFormat_MMMM-dd-yyyy;true']

Add a new line to your variable configuration named "tags".
Input the Date field tag information you copied down, ensuring the correct format as seen here.
tags: ['DateFieldFormat_MMMM-dd-yyyy;true']

11. For the Time variable, first modify the "input" line

For a variable containing time information, input "TimeField". This will enable the use of these additional formatting tags.

For the Time variable, first modify the "input" line

12. Add a new line to your variable configuration named "tags". Input the Time field tag information you copied down, ensuring the correct format as seen here. tags: ['TimeFieldConfig_5;15']

Add a new line to your variable configuration named "tags".
Input the Time field tag information you copied down, ensuring the correct format as seen here.
tags: ['TimeFieldConfig_5;15']

13. Click on Save and Continue Edit

Click on Save and Continue Edit

14. Refresh your MegaEdit product to see these updated variables in action

Refresh your MegaEdit product to see these updated variables in action

15. The date and time can be changed within the main user-facing form, with the information updated in the relevant field containing both associated variables.

The date and time can be changed within the main user-facing form, with the information updated in the relevant field containing both associated variables.

Individual Search Words:

calendar, timestamp, formatting, input, configure, tag, script, picker, settings, template

Alternate Search Phrases:

date and time configuration, input formats, field formatting, date picker setup, time input field, script tag usage, variable formatting, calendar settings, timestamp input, Infigo MegaEdit configuration