Current Date Time
Introduction
This function gets the system’s or device’s date and time in a specific format. When you configure this function, you need to define the format of the date and time. Later, you can display the current date and time in the element on the application or store it in the attribute.
Examples and Use Cases
When to Use
You can use the CURRENTDATETIME function in the following scenarios:
- Capturing API Execution Time:- If you are creating an application module, you can use this function to capture the date and time at which the API was executed.
- In Banking Transaction Details:- You can frequently use this function in the banking apps that capture the date and time at which the banking transaction took place.
- Monitoring Users Login Details:- You can use the CURRENTDATETIME function in the algorithm of the login page. It will capture the date and time at which the user logs in to the application.
- Time Related Calculations:- You can use the CURRENTDATETIME function to validate or calculate the recurrence of activity. You can use this scenario in the monitoring application and scheduler services.
Pre-requisite
Application Page
Assume you have an application where you want to get the data from the user related to his or her personal information and last interview date. On the application page, you have the following elements:
- Input Field (Label: Full Name)
- Input Field (Label: Last Interview Date)
- Button (Label: Submit)

Assume you want to capture the date and time at which the user entered his or her name and last interview date and submitted them. To implement this functionality, you need to map a task group to the onClick event of the Submit button.
Defining and Entity
Assume you want to store the current date and time in an attribute. To store the current date and time, assume you create a JSON object named user_info in the Data Modeler module. It has the following structure:

When the end-user clicks the Submit button, the application stores the last interview date, the user’s full name, and the date and time at which the user submitted data in the following attributes:
- fullName
- lastIntdate
- currDateTime
Concepts
After you create an entity to store the current date and time in the currDateTime attribute, you need to create a task group. In the task group, you will implement the functionality to copy the current date and time to the currDateTime attribute.
Creating a Task Group
To create a task group, see the Creating a New Task Group post. After you create a new task group, the Task Groups page displays it in the list of the task groups. In the task group, you can define the algorithm to use the CURRENTDATETIME function as follows:
To create a task group:
- In the list of task groups, double-click the name (for example, GetCurrDateTime) of the task group to display the <<task group name >> page.
- On the <<task group name >> page, in the Task tab, search and find the Copy Data task.

- After you find the Copy Data task, drag it to the Execution panel.
- Under Copy Data, in the Copy Data box, click the application tree icon(
) to display the Copy Data panel.
Note:- To learn how to use the smart selector to map the different items (elements, entities, and attributes) in the Copy Data panel, click here.
- In the Copy Data panel, map different elements and attributes as follows:
- Map the reference name (InputField_fullname) of the Full Name input field to the fullName attribute. In the Copy From box, select InputField_fullname. In the Copy To box, select fullName.
- Map the reference name (InputField_lastinterviewdt) of the Last Interview Date input field to the lastIntdate attribute. In the Copy From box, select InputField_lastinterviewdt. In the Copy To box, select lastIntdate.
- Map the output of the CURRENTDATETIME (CURRENTDATETIME (dd-mm-yyyy hh:mm:ss)) function to the currDateTime attribute. In the Copy From box, select the CURRENTDATETIME and enter dd-mm-yyyy hh:mm:ss in place of the format parameter. In the Copy To box, select currDateTime.

- After you map all items, click Select to configure all mapped items.
- On the <<task group name >> page, click Save to configure the task group.
Map Task Group to onClick Event of Element
After you define the task group, you need to map it to the onClick event of the Submit button. When the end-user clicks the Submit button, the Copy Data task picks the output of the CURRENTDATETIME function and then stores it in the currDateTime attribute.
To map the task group to the onClick event of the element:
- On the vDesigner canvas, click the Submit button to display the Button panel.
- In the Button panel, clicks the Events icon (
) to display the list of events.
- In the list of events, see the Add Task Groups icon (
) to the right of the onClick event.
- Click the Add Task Groups icon (
) to display the Event Configuration page.
- On the Event Configuration page, in the Task Group panel, find the task group (for example, GetCurrDateTime) that you want to link to the onClick event.

- After you find the task group (for example, GetCurrDateTime), drag it to the Execution panel to display one or more tasks that you configured in the task group.
- Click Save to link the task group to the Submit button.
The End Result
After entering the name and last interview date, when the user clicks the Submit button, the application executes the Copy Data task in the task group. In the Copy Data task, the CURRENTDATETIME function picks the device’s current date. Thus, the Copy Data task stores the current date and time in the currDateTime attribute in the entity.
Best Practices
To use the CURRENTDATETIME function smoothly during the application development in the vDesigner module, you are recommended the following set of best practices:
- In the CURRENTDATETIME function, define the date format supported by the vDesigner module.
- When you use the element and define entities and attributes, use easy-to-remember reference names and names so that you select them without a hassle while mapping in the smart selector.
- To implement a specific application scenario, make a habit of creating a new task group. Do not use a single task group for multiple functional scenarios. This approach makes the application design clutter and complex.
- When you are using entities, use a clean and relevant JSON structure of the entity.
- Before you use the entity in the application, link it to the data model.
Troubleshooting
If using the CURRENTDATETIME function does not return the expected result, check:
- If you defined the correct mapping between elements and attributes or selected the correct element to link the related event to the task group.
- If you use an API for data manipulation, make sure you establish the correct mapping between the API’s parameters and elements or attributes.