String was not recognized as a valid Date Time

image
Pls help me to resolve this

@Kuldeep_Pandey

What is your code?

DateTime.ParseExact(“Data3”,{“M”,“MM”,“MMM”,“MMMM”},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString(“MMMM”)
applied this whats the type of variable?

Variable type should be string. For datetimeformat,you need to remove .tostring(“MMMM”) code which is at the end.


same error

what is the datatype of Data5? and give me the code

String is the datatype i have given

change it to datetime

Hi,

For now, can you try to remove double quote surrounding Data3 as the following?

DateTime.ParseExact(Data3,{"M","MM","MMM","MMMM"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM")

Regards,

assign :String was not recognized as a valid DateTime.
same error

HI,

Can you share content of Data3 using WriteLine activty or LocalsPanel when error occurs in debug mode?

Regards,

Data3.Tostring(“MMMM”)
data3 is datetime variable

D3 is the month name but the name is coming in no like 10 or and other output its coming october as month name

so i give this assign activity so it will take always as month name either its coming name or no

HI @Kuldeep_Pandey

Check out your post

If you add augus Like this it will not recognized

Can you print the Data3 and share the format?

Regards
Gokul

Hi,

Can you share screenshot of WriteLine or MeesageBox for data3?

Regards,

image
Data3 output

october in another output its giving always as full month name or month no like august september or 9 ,10

Hi,

There might be extra whitespace. Can you try Trim method as the following?

DateTime.ParseExact(Data3.Trim,{"M","MM","MMM","MMMM"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM")

Regards,