I would guess your dates aren't in a date type but are character strings representing dates. You should fix that first.
Also its a bad idea to share code text as an image when you can share it by copy and pasting into the forum posts. The forum posts support a simple markdown so code formatting is available by signifying open and close of a code block with triple backticks
```
share code like this
```