L
L
ligisayan2018-08-01 11:57:59
Smarty
ligisayan, 2018-08-01 11:57:59

How to change date format output in smarty?

Hello! There is a meta field with a field fragment on smarty

<meta itemprop="datePublished" content="{$news.date}">

The output is a date in the format: July 31, 2018
And how to bring it to this format? Ydm (2018-07-31)
In pure php, I understand that it can be done through the output of the data() function, but I am not familiar with smarty

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2018-08-01
@ligisayan

https://www.smarty.net/docsv2/en/language.modifier...
That is, it will turn out something like this:

<meta itemprop="datePublished" content="{$news.date|date_format:"%Y-%m-%d"}">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question