M
M
MaxQw2020-07-21 22:52:18
Twig
MaxQw, 2020-07-21 22:52:18

How to merge (not add) Ymd and H:i in twig?

Question for connoisseurs))

Octobercms is extended with Twig Extensions filters, ie. available:
supported filters strftime, uppercase, lowercase, ucfirst, lcfirst, ltrim, rtrim, str_repeat, plural, truncate, wordwrap, strpad, leftpad, rightpad, rtl, shuffle, time_diff, localizeddate, localizednumber, localizedcurrency, mailto, var_dump, revision, sortbyfield.

There are {{ date|date('Ymd') }} and {{ time|date('His') }} , is it possible to concatenate (NOT ADD) these values ​​to compare (greater than, less than) with {{ "now"| date('YmdHis') }} ?

If so:
{{ date|date('Ymd') + time|date('His') }}, then the value is simply added, i.e. 2020 07 21 + 19 00 00 = 20390721, but you need 20200721 ​​190000.

Can this be done in a twig template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxQw, 2020-07-21
@MaxQw

Doper))
Instead of + need ~

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question