Enonic version: 7.2.0
OS: Ubuntu 18.04
I was thinking here if there was some way to get the current year as a default value for a Long (or maybe a TexLine) field.
Would it be possible?
I was thinking here if there was some way to get the current year as a default value for a Long (or maybe a TexLine) field.
Would it be possible?
Hi Vivi Ornitier,
A Date-field would be best suited for any date-related storage. In Date
and DateTime
input fields you can use now
as value inside <default>
when setting up the content type. This will get today’s date (and year). However, month and day would also be in the field, but you can remove that when displaying the information to site visitors. A Long
or TextLine
type of field would output now
as a string.
More information here: https://developer.enonic.com/docs/xp/stable/cms/input-types#date