Convert "September 22 at 2:00pm" to DateTime Variable

How do I convert a string in the following format “September 22 at 2:00pm” to a datetime varaible.

I need to do this because I need to compare it to dateTime.Now and see their difference in DAYS.

Please let me know how I can accomplish this

I know I can just split the string to get the Date, ex 22, then compare to DateTime.Now which would be 24 and therefore the difference is 2 days.

However I also have to consider the months.

Fine
here is the expression
if in_str = “September 22 at 2:00pm”
the
out_Datetime = Datetime.ParseExact(Split(in_str.tostring," “)(0).tostring+” “+Split(in_str.tostring,” “)(1).tostring+” "+now.tostring(“yyyy”),“MMMM dd yyyy”,system.globalization.cultureinfo.invariantculture)

where out_Datetime is a variable of type datetime

Cheers @Sami_Syed

1 Like

Thank you so much.

I also need help with something else:

If you have knowledge about this please help me out!

Sure
Let me check once
Cheers @Sami_Syed

1 Like

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