Convertion of string to date

Im having the data in form of “28 Jun 2023” in string format i need to compare with current date and give result as past date or future date need help regarding the logic to convert string to date

Thanks in advance

@madhavraichur25,

Use this in Assign activity

datetimevariable = DateTime.ParseExact("28 Jun 2023","dd MMM yyyy",System.Globalization.CultureInfo.InvariantCulture)

This will give you datetime type date.

Compare date with today:
datetimevariable.Date < Now.Date - Past Date
datetimevariable.Date > Now.Date - Future Date

Sample Code:

Output:
image

Workflow:
Workflow1.xaml (7.9 KB)

Thanks,
Ashok :slight_smile:

Hi,

Can you try just CDate as the following?

image

So, in IF condition, it will be as the following.

CDate(yourString) > Today

Regards,

Hi @madhavraichur25

inputstr = "28 Jun 2023"
dateTime = DateTime.ParseExact(strDate, "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture)
if
dateTime < DateTime.Now


Hope it helps!!

@madhavraichur25

dateFromString = DateTime.ParseExact("28 Jun 2023", "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture)
If:dateFromString < currentDate

There is an activity available
Just try that