UiPath - Convert String to DateTime

uipath convert string to datetime finesse talks
UiPath - Convert String to DateTime

We need to convert a string date to DateTime format very frequently whenever we are going to work with date and times.

Let’s understand and convert string to DateTime in UiPath using an example below:

Step 1 – Take a variable/argument to store the string date

in_DateString = "01/01/2020"

uipath-convert-string-to-datetime-assign-string-date
Assign String Date

Step 2 – Take a variable/argument to store the string date format

in_DateStringFormat = "dd/MM/yyyy"

uipath-convert-string-to-datetime-assign-string-date-format
Assign String Date Format

Step 3 – Convert string to datetime using below provided method

out_DateTime = DateTime.ParseExact(in_DateString,in_DateStringFormat, System.Globalization.CultureInfo.InvariantCulture)

uipath-convert-string-to-datetime
Convert String To DateTime

The variable/argument out_DateTime would contain the date value in DateTime format.

Comments

Popular posts from this blog

Filter DataTable in UiPath Studio

UiPath - Initialize Array and Assign value to Array