Convert Date "dd Mon yyyy"

Hi All,

How do you convert the scraped data in the format “dd Mon yyyy” into the standard “dd/mm/yyyy”? Any help would be greatly appreciated

yah like this
str_datevalue = Datetime.ParseExact(strinput.ToString,“dd MMM yyyy”,system.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Cheers @Stabbathehut

What if the string is in a datatable in the first column under column name Date Published

then use a FOR EACH ROW activity where we can pas the datatable as input
and inside the loop use a ASSIGN ACTIVITY like this
row(“Date Published”) = Datetime.ParseExact(row(“Date Published”).ToString,“dd MMM yyyy”,system.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Cheers @Stabbathehut

Depends what do you want to do with the date? is some calculation or just to write somewhere? If the second then:
Datetime.ParseExact(row(0).ToString,"dd MMM yyyy",system.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")


so what I am trying to do is iterate through the date published column where it checks which values in the column equal todays date and then carry on with the process

yah use the expression like this in IF condition
Datetime.ParseExact(row(“Date Published”).ToString,“dd MMM yyyy”,system.Globalization.CultureInfo.InvariantCulture).Equals(Datetime.Now)

Cheers @Stabbathehut

It says that string was not recognized as a valid DateTime

Fine lets validate like how we are getting the value from excel
before this IF condition use a writeline activity and mention as row(“columnnam”).ToString
so that we can see the value in output panel based on which we can change the expression in IF condition
kindly share the screenshot of it plls

Cheers @Stabbathehut

the expression be like this in IF condition
Datetime.ParseExact(row(“Date Published”).ToString.SubStrinng(0,10),“dd/MM/yyyy”,system.Globalization.CultureInfo.InvariantCulture).Equals(Datetime.Now)


So you excel already has that column as a Date and not string, you dont need to do anything to it to verify if it is the same day as today, did you even try in you IF:
DateTime.Compare(CDate(row(0)), DateTime.Today) = 0

Hi I tried that and it is saying conversion from string “17/01/2020” to type ‘Date’ is not valid

1 Like

DateTime.Compare(Datetime.ParseExact(row(0).ToString,"dd-MM- yyyy",system.Globalization.CultureInfo.InvariantCulture), DateTime.Today) = 0

did this expression helped us on this

No errors but the if statement doesn’t work. Can you try this before suggesting as its a bit frustrating trying these ways when none of them have worked

string is still not recognised at datetime

so then you do not have this format: 17/01/2020

I am just confused with the formatting of this.

This is just the way excel shows you this data, does not mean it gets to your datatable like that…