Using Date Time Variables
DateTime is a variable type similar to Int32 and Boolean available in System namespace System.DateTime. DateTime helps to find out information about Date and Time, such as getting month, day, year, weekday, which eases handling of date and a time in any process. It also helps to compute date difference, the addition of the number of days, etc. Refer to Microsoft documentation for more details.
Adding 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 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 with an example process. This example takes user input Date of Birthchecks whether the user is eligible for voting by displaying age. Flowchart 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
Add Flowchart activity.
Step#5
In Activity panel search for Input Dialog
Drag and drop Input Dialog activity into body of For Each.
Takes the DOB in format ex:<01 Jan 2021>and sets to userInput
Step#6
- Add Multi Assign activity.
- Assign variable to hold the age.
Step#7
- Add Flow decision connecting the flow and checking the user input to route the control based on condition.
Step#8
Save the process
- From the Design tab ribbon, click on Save
Step#9
Run the process
- From the Design tab ribbon, click on Run
Step#10
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