Question: I have controller method which have 2 input parameters : `DateTime dFrom, dtTo`.

So, now I check interval like this:

```
public async Task<ActionResult> GetValues([FromQuery] DateTime dtFrom, [FromQuery] DateTime dtTo)
{
    if (dtFrom > dtTo)
    {
        return BadRequest($"{nameof(dtFrom)} < {nameof(dtTo)}");
    }
}

```

But, I want to make validation like this:

```
[DateFilterAttribute(dtFrom,dtTo)]
public async Task<ActionResult> GetValues([FromQuery] DateTime dtFrom, [FromQuery] DateTime dtTo)
{
    if (dtFrom > dtTo)
    {
        return BadRequest($"{nameof(dtFrom)} < {nameof(dtTo)}");
    }
}

```

Where `DateFilterAttribute`:

```
 public class DateFilterAttribute : ActionFilterAttribute
 {
    private DateTime _fromDt;
    private DateTime _dtTo;
    public DateFilterAttribute(DateTime fromDt, DateTime dtTo)
    {
        _fromDt = fromDt;
        _dtTo = dtTo;
    }

    public override void OnActionExecuting(ActionExecutingContext context)
    {            
        context.HttpContext.Response.StatusCode = 400;
        var errorStr = $"{nameof(_fromDt)} < {nameof(_dtTo)}";
        context.HttpContext.Response.Headers.Add("Error", new string[] { errorStr });
    }
  }

```

But, I can not use input parameters at attribute.
So, can I do this? And is it right way?

Answer: 
```
grep "$(date "+%Y-%m-%d %H" -d '1 hour ago')"

```

must work

```
[root@dell-shatov-dk ~]# cat ./test.log 
2020-11-02 07:21:10.104 t1
2020-11-02 08:21:10.104 t2
2020-11-02 09:21:10.104 t3
2020-11-02 10:21:10.104 t4
2020-11-02 11:21:10.104 t5
[root@dell-shatov-dk ~]# grep "$(date "+%Y-%m-%d %H" -d '1 hour ago')" test.log
2020-11-02 11:21:10.104 t5

```
```
grep "$(date "+%Y-%m-%d %H" -d '1 hour ago')" test.log

```