Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • This answer has issues with quoting, and it's unclear where to set the DATEVAR variable and how to do it in such a way that it support e.g. format string containing spaces. Commented Jan 11, 2021 at 9:47
  • 1
    Quoting is fixed. You put the definition in the head of your crontab file Commented Jun 7, 2022 at 0:57
  • 1
    this approach will however leak $DATEVAR into the environment of every cron entry in that cron tab. for me this is unacceptable, and i would simply escape the %'s. Commented Jul 6, 2024 at 16:59