If: String was not recognized as a valid DateTime. help

hi community
need help with this issue where i try to get the publication date of news website and i dont where to fix it anymore.
this is my workflow


assign : System.Text.RegularExpressions.Regex.Match(DateWEbsite, “(?<=, ).+ \d{4}”).ToString().Trim()
if condition: CDate(in_TransactionItem(“Date”).ToString).Date = DateTime.Parse(DateWebsite, New System.Globalization.CultureInfo(“my-MY”)).Date

i tried to match it with the one in the excel file. the format is like this
image

Hi,

Can you share content of DateWebsite?

Regards,

hi sorry do you want the website content?

Nope, can you share content of DateWebsite variable?

HI,

Can you try to set Breakpoint at the IF activity and Debug run? Workflow will stop there, then check Locals panel?

Regards,


sorry do you mean this one?

image
here is the result

Hi,

According the above image, DateWebsite variable is empty. So it’s necessary to review settings of GetText activity and/or regex pattern.

Regards,

hi this is my current setting for get text activity

and this is the regex pattern: System.Text.RegularExpressions.Regex.Match(DateWEbsite, “(?<=, )\w+ \d{1,2}, \d{4} @ \d{1,2}:\d{2}[ap]m”).ToString().Trim()

Hi,

First, can you check output of GetText activity? Is it empty? If so it’s necessary to review selector settings. From the above image, it seems necessary to remove aaname attribute because it’s dynamic.

Regards,

hi i try remove the aaname but i still got the error If: String was not recognized as a valid DateTime. i also check the get text output but it return null

It’s necessary to modify selector settings of GetText. It may be also good to add anchor.

Regards,

@Iman_Shafeeq,

It’s clearly an issue of Get Text Selector. Fix the selectors and you should be fine.

Thanks,
Ashok :slight_smile:

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