Page 1 of 1

LISE Date/Time Custom Field

Posted: Thu Jul 04, 2019 8:00 am
by rbaby
Hi all,

How would you set the template to only display a record if the custom date time field you added is greater than today? Is this custom field definition also respectful of the timezone you set for the CMS or is it UTC?

Thank you!

Re: LISE Date/Time Custom Field

Posted: Thu Jul 04, 2019 2:59 pm
by DIGI3
Not tested, but you'd want to do something like this:

Code: Select all

{$today=$smarty.now|date_format}
{$mydate=$item->fielddefs.mydate.value|date_format}
{if $mydate|strtotime > $today|strtotime}
  this date is in the future
{else}
  this date is right now or in the past
{/if}
It should use your server's local time, but you can confirm by echoing {$smarty.now} on any page.

Re: LISE Date/Time Custom Field

Posted: Sun Jul 07, 2019 10:16 am
by rbaby
Thank you DIGI3, I appreciate you taking your time to help me.