Hi all I am checking a condition where
nssd>=acm Below are the dates.
I should get True but here the bot is taking as false
nssd=02/01/2024 00:00:00
acm =01/19/2024 00:00:00
Hi all I am checking a condition where
nssd>=acm Below are the dates.
I should get True but here the bot is taking as false
nssd=02/01/2024 00:00:00
acm =01/19/2024 00:00:00
What do you want to compare?
Are the below inputs?
nssd=02/01/2024 00:00:00
acm =01/19/2024 00:00:00
Regards
yes .compare two dates .with out time stamp
condition is nssd>=acm (whther True or false ). It should be true I believe as its nssd =feb and acm is in Jan
nssd=02/01/2024 00:00:00
acm =01/19/2024 00:00:00
the above are string inputs right?
Regards
Try this,
DateTime.ParseExact("02/01/2024 00:00:00", "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture) >= DateTime.ParseExact("01/19/2024 00:00:00", "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture)
Thanks,
Vinit Mhatre
Try the below way:
Assign-> nssd = "02/01/2024 00:00:00"
Assign-> acm = "01/19/2024 00:00:00"
Assign-> str_nssd = DateTime.ParseExact(nssd, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MM")
Assign-> str_acm = DateTime.ParseExact(acm, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MM")
If
nssd >= acm
Then
Print TRUE
Else
Print FALSE
End If
the variables in Assign are of DataType System.String.
Regards
DateTime.ParseExact(nssd,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture) >= DateTime.ParseExact(acm,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture)
Try this this will work.
or pass this in If
DateTime.ParseExact(nssd, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MM") >= DateTime.ParseExact(acm, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MM")
Regards
.ToString(“MM”) will take the months from the data and compare that. So, in nssd it is 02 i.e Febuary and in acm it is 01 i.e January since Feb is greater than Jan it will print true.
From the give string inputs I have taken the months and compared within If
Regards
For more information you can refer the below thread regarding DateTime. This will give you an idea on it.
Regards
Then in that case you can pass the below condition in If
nssd.ToString("MM")>=acm.ToString("MM")
Regards
Output Datatype is boolean
Output=DateTime.ParseExact(nssd.ToString, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.ParseExact(acm.ToString, "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture)
I need to check the dates .Even if same month but dates are different it .
For example if acm = 02nd feb and nssd =19 th feb it should be true
nssd.ToString("dd")>=acm.ToString("dd") And nssd.ToString("MM")>=acm.ToString("MM")
Regards
If you have different Formats of dates Please change to One Format and then check your condition.Please provide all your dateformats so that we will help you
you are comparing dates of two variables and months of two variables. This syntax should help you.
nssd.ToString("dd")>=acm.ToString("dd") And nssd.ToString("MM")>=acm.ToString("MM")
Regards