Skip Navigation

[Resolved] Compare date field to NOW in Conditional Output

This support ticket is created 5 years, 2 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#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"