NHoe
(Norman)
1
Hi all, I get a date from a website, from this date I only need the day.
As an example 19.05.2021 I need the 19th day.
How do I get that right?
I did it with CDate(strErsatzdatum).Day.ToString, but I get the message "Conversion from string “19.05.2021” to type Date is not valid
@NHoe - if its a string…please try
"19.05.21".split("."c)(0)
You can try this way too @NHoe
Let’s say u are getting date from web as string and stored in variable date_1
Now use
DateTime.ParseExact(date_1,“dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd”)
Regards
Nived N 
Happy Automation 


1 Like
NHoe
(Norman)
4
thank you all, both variants work very well.
One more question afterwards DateTime.ParseExact(date_1, “dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd”)
how can I add +x days to this value?
DateTime.ParseExact(date_1, “dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd”) +5 does not work
I could be wrong, but is it because you have it as a string? Do you need to convert it to an integer before you can do the addition of the 5 days?
Hi @NHoe
This way of assign would work
DateTime.ParseExact(date_1, “dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddDays(5).ToString(“dd”)
NHoe
(Norman)
7
@NIVED_NAMBIAR it work´s very well, thank you
1 Like
Please mark the appropriate answer as solution so that we can close the topic 
1 Like
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.