Would like to understand the detailed explanation of this formula posted below

"[ReceivedTime] >= ’ " + now.AddDays(-1).ToString(“MM/dd/yyyy hh:mm tt”) + " ’ "

I had few questions regarding this equation from tutorial for fetching mails from last 24 hrs.

1)Why are there both single and double quotes in the start and end in this :
’ " + now.AddDays(-1).ToString(“MM/dd/yyyy hh:mm tt”) + " ’

2)Why is it tt and not ss (for seconds)

3)what is that + symbol for(Since we are not concatenating)and why cant it be like tis :
“[ReceivedTime] >= ’ " now.AddDays(-1).ToString(“MM/dd/yyyy hh:mm tt”)” ’ "

Thank u in advance for taking out time to reply !

Understand that this code is being passed to another piece of code as a parameter, therefore (1) it has to use double and single quotes, resulting also (3) in the need to concatenate the string that will form part of that code. As for “tt” (2), I assume this is part of the syntax of the target code to which this is being sent (C# I assume as tt denotes provision of the AM/PM subfix to datetime)

@Vidya_Srinivasan

  1. Filtering emails uses single quotes for parameters. So [ReceivedTime] >= '07/19/2019 00:00' would be a valid filter. UiPath requires the filter to be a String type, which is denoted by using " characters. So the entire filter must be encased in ".

  2. As @ronanpeter said, “tt” is the DateTime parsing for am/pm. Here is a detailed breakdown of all of the possible DateTime formatting.

  3. I’m not sure where you’re getting this from:

It certainly is concatenating. There are three string being added together: the first is "[ReceivedTime] >= ’ ", the second is now.AddDays(-1).ToString(“MM/dd/yyyy hh:mm tt”) , and the final one is "’".

Thank you so much ronan and daniel !

1 Like