Issue in finding the date difference

From system i am getting it in : 06-17-2024 (MM-dd-yyyy)

from sharepoint i am getting it : 14-06-2024 (dd-MM-yyyy)

how to calculate the difference of days

Hi @mint

Try the below syntax

systemDate = DateTime.ParseExact("06-17-2024", "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)

sharepointDate = DateTime.ParseExact("14-06-2024", "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)

differenceInDays = (systemDate - sharepointDate).Days

systemDate: System.DateTime
sharepointDate: System.DateTime
differenceInDays: System.Int32

Regards

1 Like

@vrdabberu can i replace date with str variable

@mint,

This way.

systemDate = DateTime.ParseExact(strDate1, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)

sharepointDate = DateTime.ParseExact(strDate2, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)

differenceInDays = (systemDate - sharepointDate).Days

Thanks,
Ashok :slight_smile:

1 Like

Yes you can do that @mint

str_SystemDate = "06-17-2024"

str_SharePointDate = "14-06-2024"

systemDate = DateTime.ParseExact(str_SystemDate, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)

sharepointDate = DateTime.ParseExact(str_SharePointDate, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)

differenceInDays = (systemDate - sharepointDate).Days

DataTypes:
str_SystemDate = System.String
str_SharePointDate = System.String
systemDate: System.DateTime
sharepointDate: System.DateTime
differenceInDays: System.Int32

Regards

Check the below workflow for better understanding @mint

FLOW:

XAML:
Sequence85.xaml (8.5 KB)

OUTPUT:

Let me know if you have any queries.

Regards

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.