Using Date Time Variables
DateTime is a variable type similar to Int32 and Boolean available in System namespace System.DateTime. DateTime helps to find information about dates and times, such as month, day, year, and weekday, which eases the handling of dates and times in any process. It also helps to compute date differences, add the number of days, etc. Refer to Microsoft documentation for more details.
Adding a new variable of type DateTime
Some commonly used DateTime methods
- Convert String date time value to DateTime. Ex:DateTime.Parse("01 Jan 2002")
- Convert DateTime to String using ToString()
- Get the current date and time using DateTime.Now
Note:
- This variable can be used to add date value to documents.
Let us understand the DateTime variable using an example process. This example takes user input Date of Birth and checks whether the user is eligible for voting by displaying age. Sequence is used to process in this example.
Come, let's create this process in Process Designer:
Step#1
Launch and create a new process in Process Designer
- Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise
Step#2
Create New Process
- Click on New Process and fill in the new process details
Step#3
- The following list of variables is used to get and compute age and eligibility.
Step#4
In Activity panel search for Input Dialog
- Drag and drop Input Dialog activity.
- Takes the DOB in format ex:<01 Jan 2021> and sets to userInput variable.
Step#5
- Add Multi Assign activity.
- Assign a variable to hold the age.
Step#6
- Add If Else activity by checking the user input to route the control based on condition.
Step#7
Save the process
- From the Design tab ribbon, click on Save
Step#8
Run the process
- From the Design tab ribbon, click on Run
Step#9
Make sure the process executes and pops up an input dialog. Enter the DOB to be checked. Click on Ok. The output message is displayed based on eligibility to vote or not.
Download Example (C#)