I am trying to compute the string expression by DataTable.Compute
.
A simple string like below is working:
static void Compare()
{
var logicalExpression = "'2022-09-14' <= '2029-12-31'";
DataTable dt = new DataTable();
var result = (bool)dt.Compute(logicalExpression, "");
}
But, the date 2022-09-14
is dynamic, it should be the date for now.
I have tried to replace '2022-09-14'
with Now()
,GETDATE()
. None of them work.
Is there any function to get current date time in Compute
?