Passing Start Date, Start Time and Duration in Sen Calendar Invite Activity

Hi All,
I need help passing queue item to Send Calendar Invite activity.

Following is Queue Data-
StartDate: 28 Jan 22
EndDate: 28 Jan 22
CourseTime: 08:00 AM - 01:00 PM

Need to convert StartDate to Date variable in UK format
StartDate (dateTime variable) = DateTime.ParseExact(modifiedDate,“MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”))

returning error cannot assign Date to String

If I convert StartDate = Convert.ToDateTime(DateTime.ParseExact(modifiedDate,“MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”))

Start Date: String was not recognized as a valid DateTime.

image

I need to pass Start Date, Start Time as seen in screenshot and Duration needs to be Course Time (Start Time minus End Time)

Kind Regards

Hi @Rubot,

As you mentioned,
StartDate (dateTime variable) = DateTime.ParseExact(modifiedDate,“MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”))

In the above variable StartDate, what is the datatype you have set?

You have extra ) in your Expression, I have modified it.
Updated expression: DateTime.ParseExact(modifiedDate,“MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Note: Both the variables, modifiedDate & StartDate must be in String datatype because in the expression at the end you have converted the value into string (.ToString(“dd/MM/yyyy”))

Check this thread for better reference:

US date to UK date - Help - UiPath Community Forum

I have shared a sample flow, in this I have created two variables:
USDate = “06/15/2020 14:45:43” [Datatype as String]
UKDate = DateTime.ParseExact(USDateTime, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture).toString("dd/MM/yyyy") [Datatype as String]

RubotUStoUK.zip (2.2 KB)

I hope your issue would be solved with the above explanation.

Regards,
@90s_Developer

@90s_Developer thanks for your reply.
I have not got StartDate working.

I need to work on Start Time, which includes StartDate plus Time in hh:mm:ss format.

Duration should be coursetime “08:00 AM to 01:00 PM” start minus end

@Rubot,

I can’t understand your requirement can you be some more specific!

Regards,
@90s_Developer

Sorry about the confussion.

So I have 3 fields in Send Outlook Meeting Invite

Start Date - DateTime Variable (dd/MM/yyyy)
Start Time - DateTime Variable (dd/MM/yyyy hh:mm:ss)
Duration - takes only Timespan variable (hh:mm:ss)

In my DataTable I have values as follows
StartDate: 28 Jan 22
EndDate: 28 Jan 22
CourseTime: 08:00 AM - 01:00 PM

In Start Date - need to Enter 28/01/2022
In Start Time - need to enter 28/01/2022 08:00:00 (i.e 8 AM meeting start time)
in Duration - need to enter total number of hours meeting will last (i.e. 00:00:30)

1st requirement. - Enter Start Date in UK format.
Convert StartDate: 28 Jan 22 into DateTime Variable and pass value in UK Date Format.

2nd requirement - Enter Start Time (Start Date + Start Time) in dd/MM/yyyy hh:mm:ss
Concatenate Start Date with Time span from Duration, make DateTime Variable and pass

3rd Requirement - Duration 8 am to 1 PM is 5 hours.
Create a TimeSpan variable and pass this 5 hours in that field.

Hope I have made it clear now.

Kind Regards,

@Rubot,

In the above message, you have mentioned StartDate value as 28 Jan 22, do you have space in between or symbols like / or .

Regards,
@90s_Developer

They have space. 28 Jan 22.

When I convert it using Datetime.ParseExact(strStartDate,“dd MMM yy” so on to convert into .ToString(“dd/MM/yyyy”) for UK date format.

@Rubot,

Please find the below updated xaml file of the workflow logic which you have requested and a sample output screenshot also I have attached.

image

RubotUStoUKV2.zip (2.5 KB)

Just replace the variable accordingly with your excel value.

Steps:

  • Assign the USDate value into a variable. (USDate variable which I have implemented in the workflow).

  • Assign UKDate = DateTime.ParseExact(USDateTime, "dd MMM yy", System.Globalization.CultureInfo.InvariantCulture).toString("dd/MM/yyyy") [which holds the US format converted to UK Format value in the workflow]

  • Now, since the Time value comes in a single string variable, we need to split them to get start time and end time into a separate variable. I have stored the Time value into a variable called (CourseTime)

  • Assign StartTime = CourseTime.Split("-"c).First.ToString [holds the value 08:00 AM]
    3.2 Assign EndTime = CourseTime.Split("-"c).Last.ToString [holds the value 01:00 PM]

  • Assign TimeDiffValue = DateDiff(DateInterval.Hour,Convert.ToDateTime(StartTime),Convert.ToDateTime(EndTime)).ToString [holds the difference value which is 5]

  • To join Start Date + Start Time: StartDate + " " + StartTime

I hope your issue would be sorted out.
Regards,
@90s_Developer