Skip to main content
added 113 characters in body
Source Link
Clive Portman
  • 2.9k
  • 19
  • 36

This works for me, starting with a string:

{% set yearbegins = '1 January ' ~ year %} // getting year from a url (dynamic route)
{{ yearbegins | date("U") }} // outputs the date in Unixtime

But, likeAre you saying this is not a real datetime object, and it's just the date filter making it look like it? I'm finding some unpredictability, too, as you know.

This works for me, starting with a string:

{% set yearbegins = '1 January ' ~ year %} // getting year from a url (dynamic route)
{{ yearbegins | date("U") }} // outputs the date in Unixtime

But, like you, I'm finding some unpredictability.

This works for me, starting with a string:

{% set yearbegins = '1 January ' ~ year %} // getting year from a url (dynamic route)
{{ yearbegins | date("U") }} // outputs the date in Unixtime

Are you saying this is not a real datetime object, and it's just the date filter making it look like it? I'm finding some unpredictability, too, as you know.

Source Link
Clive Portman
  • 2.9k
  • 19
  • 36

This works for me, starting with a string:

{% set yearbegins = '1 January ' ~ year %} // getting year from a url (dynamic route)
{{ yearbegins | date("U") }} // outputs the date in Unixtime

But, like you, I'm finding some unpredictability.