I am trying to get the start of today's date and time in Twig. I found that you can get the start of the current week by doing the following:
{{ now | date_modify('monday this week')|date('d-m-y H:i:s') }}
So I assume there will be a way to do this for the start of today. So far, I have tried:
{{ now | date_modify('start of day')|date('d-m-y H:i:s') }}
{{ now | date_modify('start of today')|date('d-m-y H:i:s') }}
Which resulted in:
PHP Warning: DateTime::modify(): Failed to parse time string (start of day) at position 0
PHP Warning: DateTime::modify(): Failed to parse time string (start of today) at position 0
I would like to know:
- What is the correct syntax to ask this?
- Where can I find a list of these strings?
- Any alternatives to passing in strings
Thank you.