Navigation überspringen

[Gelöst] Default date format

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

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von julesW vor 4 years, 5 months.

Assistiert von: Minesh.

Author
Artikel
#2233505
2021-11-30_Toolset_DateFormat.png

Hello

Is there a way to set a default date format?

I'm using Divi Plugin's FilterGrid to bring in posts, which works, but the date is not formatted. See attached screenshot

Below is the shortcode that is generated for that custom field. (see screenshot)
[{"name":"wpcf-litter-name","label":""},{"name":"wpcf-litter-birth-date","label":""},{"name":"wpcf-litter-excerpt","label":""}]

I contacted DiviPlugin support and they said that I would have to format it where it is being created. I looked and did not see a setting for date formatting.

LInk to live page: versteckter Link

Thank you for your time and help
Jules

#2233761

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The thing is that the custom date field you created using Types stores the value as a UNIX Timestamp to database.

When you try to access the field as post field, it will retrieve the stored value that is UNIX Timestamp from the database. To display the UNIX Timestamp to human readable format you will have to convert the UNIX Timestamp to date and for that I suggest you should write a custom shortcode that should return you the formatted date based on the UNIX Timestamp as per your requirement.

I'm not sure if custom shortcode is allowed instead of the custom field but that is the only possible solution I can think of. You will have to check that.

#2236651

Thank you!