Skip Navigation

[Resolved] How do I output the name of the day of the week with a date field

This thread is resolved. Here is a description of the problem and solution.

Problem:

The user had used out datepicker field to select a date on the backend but only wants to display the Day rather than the entire date.

Solution:

This can be done using the following shortcode.
[types field='agenda-datum' style='text' format='l'][/types]

Where you will replace "agenda-datum" with the slug of the custom field and using the format attribute to choose which component of the date you want to display or how you would like the date to be formatted.

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date

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

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

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by sandraB-2 4 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1739375

Tell us what you are trying to do?
Ik want to show the name of the day in a view when outputing the date.

Is there any documentation that you are following?
I used PHP date formating characters D en l, but they don't seem to work

Is there a similar example that we can see?

What is the link to your site?

hidden link

I would want to output for instance 'zondag 23 aug 2020'. 'Zondag' is Dutch for Sunday. So I would want to output the day of the week. I use a datefield for the dates in the agenda with events.

Is there a way to do this? I tried this: [types field='agenda-datum' style='text' format='l'][/types] and [types field='agenda-datum' style='text' format='D'][/types]. Both didn't work.

Can you please help me with this?

Kind Regards,
Sandra Berends

#1739667

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-08-14 at 11.06.34 AM.png
Screenshot 2020-08-14 at 11.06.39 AM.png

Hi Sandra,

Thank you for getting in touch.

Using the format

[types field='agenda-datum' style='text' format='l'][/types]

Works for me on my end. See my screenshots

Can you try again and let me know what exactly displays.

Thanks,
Shane

#1739863

Hi Shane,

Thanx for the fast response!!

The problem is that to build the dates in the agenda I use 3 shortcodes for the same date field. Each with a different format: the first to show the date number, the second to show the month, and the third to show the year. If I add another shortcode with the format as you described, I simply couldn't save. I get an error message in red which says that one or more sections could not be saved.

I tested your shortcode instead of an an existing one and your shortcode works just fine. So I was wrong. The format l of D works oké. But if I added it (so I use four shortcodes) I get the error message. Maybe it is a memory issue or something like that. At least it seams not to be a toolset problem 🙂

What I have done now is, I removed the year and instead used the name of the week day. So everything is just fine.

Thanks for your help. You guys are allways great!!
Have a nice day!!
Sandra

#1739877

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Sandra,

Not sure why you're getting this error but i'm happy the format attribute is working for you now.

If there are no further queries on this then you can mark this ticket as resolved.

Please keep safe.
Thanks,
Shane

#1740165

My issue is resolved now. Thank you!