Navigation überspringen

[Gelöst] Compare date field to NOW in Conditional Output

This support ticket is created vor 5 Jahren, 8 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Luo Yang vor 5 Jahren, 8 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#1321753

Hi I have a toolset date field.

I would like to vary the display of what that field shows based on the current time.

Basically like so:

[wpv-conditional if="( $(wpcf-cancel-date) lt 'NOW' )"]

Where "NOW" would be the current date and time. Is there some way to achieve that without me writing my custom shortcode?

#1321783

Hello,

It is possible within [wpv-conditional] shortcode, for example:

[wpv-conditional if="( $(wpcf-cancel-date) lt 'NOW()' )"]
...

see our document:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-types-fields-and-custom-fields/#checking-if-a-date-is-today

section "Checking if a date is today"