Sauter la navigation

[Résolu] date format

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Ce sujet contient 4 réponses, a 2 voix.

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

Assisté par: Minesh.

Auteur
Publications
#1487709

I use Elementor to retrieve the custom date field (slug: event-date) created by Toolset. I put the shortcode [wpv-post-field name="wpcf-event-date"] and it returns a date stamp like 1577750400. How can I format it to the date? I try to use format="Y-m-d" inside the shortcode, but it fails.

#1487949

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

If you created the date type custom field using the Types plugin, you should use the Types shortcode to display the date that will allow you to display the formatted date.

For example:

[types field="event-date" format="Y/m/d g:i:s A"][/types]

More info:
=> https://toolset.com/documentation/customizing-sites-using-php/functions/#date

#1488121

My issue is resolved now. Thank you!

#1488829

The date field set by Types is with multiple instances, so the returned values will be like 2020/1/29 2020/1/30 2010/1/31. Can I separate them by comma? That would be easy for the visitors to read.

#1489661

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

You can use the separator attribute to separate the multiple instance date field vlaue:

For example:

[types field="event-date" separator=","  format="Y/m/d g:i:s A"][/types]

More info:
=> https://toolset.com/documentation/user-guides/custom-content/repeating-fields/#Displaying%20Repeating%20Fields