Personal Travel Assistant (Issue with date conversion)

Hi All,

Just having a bit of an issue with date conversion. I am trying to ensure that when I get a user specified date I am able to input it into expedia in the correct format. If you have a look at my code you are able to see I have used the DateTime.ParseExtract function but am still having no luck.
Personal_Travel_Assistant.zip (17.1 KB)
Below is the error I am receiving

Hello! Can you give some more details about how that string looks like? Or are you saying that the user can input the date in any format and you have to be able to determine in what format the date is?

@Stabbathehut

From your xaml I can see the following issue, check and correct it. Else provide some additional information.

User input date - Holding in DepartDate variable

You are passing value to typeinto activity using - StrFlyingToDate variable

But you have declared a datetime variable as “ConvertedFlyingToDate” and not using anywhere.

There is no connection between all the above variables.

If you need to pass the user input date to the typeinto with a correct format then try the following,

DateTime.ParseExact(DepartDate.ToString, “dd/MM/yyyy”,system.Globalization.CultureInfo.InvariantCulture)

Thanks for the help so far!


This is what I am getting now. I have tried it as an object, string and a system.string but it doesn’t seem to be able to convert from date to string

So I am saying that the user can put the date in any format and then it needs to be converted to a standard of “dd/MM/yyyy”

@Stabbathehut,

You have modified the StrFlyingToDate as string array, which is the reason for this issue.

Please share which value to be converted to which format and datatype.

I would like both DepartDate and ReturnDate to be converted. And like I said to the form of “dd/MM/yyyy”
so it can be placed into here:

@Stabbathehut,

Then in the typeinto for the departure date use the below code,

DateTime.TryParseExact(Convert.ToString(DepartDate), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, Nothing)

Change the DepartDate variable in the above code to ReturnDate and use it in the Returning date type into activity.

This is where an error occurs where its trying to convert boolean to string

You should request an especific format in the input message that you have have. Something like “The format must be dd/MM/yyyy for example 22/10/2022” and use a Regex expresion after that, and if the text quote by the user has not the format you can put a message box and request the date again. Thats what pages does to us when we try to buy o what we want to do. The problem that i see, is if someone gives you a date like “08/09/2019” and is in format MM/dd/yyy you will cant know if it is happening.

Sorry for my english.

1 Like

@Stabbathehut,

Main.xaml (23.9 KB)

Check this one and let me know if any issues

Only problem is its converting it into MM/dd/yyyy