Skip Navigation

[Résolu] Compare date field to NOW in Conditional Output

This support ticket is created Il y a 5 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Marqué : ,

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Luo Yang Il y a 5 années et 3 mois.

Assisté par: Luo Yang.

Auteur
Publications
#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"