I tried to convert string to datetime with format “dd-MMM-yyyy” before converting back to string with format “d/M/yyyy” but an error would appear saying cannot assign to my new variable name which is in string datatype
DateTime.ParseExact(StartBlackout,“dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString(“d/M/yyyy”) is the code
I also tried splitting by getting the DateTime variable first but it also comes out with the same cannot assign error. Any part I might have had an oversight? Thanks
StartBlackout is a get text output variable (A) always in the form “dd-MMM-yyyy”
and i want to get a new string variable (B) with the form “d/M/yyyy” so that i can retrieve a datetime value from excel and create a condition that is something along the lines of B = exceldate (which is in the form d/M/yyyy)
i managed to get excelStart value to be exactly the same format as realStart but when i run the if else function, it always gives me false even tho both are same datatype of string? what could possibly be the error?