Drupal Training, Consulting, & Development by Doug Vann
I am a codementor



Adding regular text into the Drupal Date Format field

Mon, 2018-01-15 11:31 -- dougvann

Q: "Can you add simple text to a Date Format value in Drupal?" A: YES! [This was news to me]
I was teaching a Drupal 8 class last week and a student asked if we could enter regular text [like the word "date"] into the Date Formate field. I tried it and, of course, some of the letters were translated into PHP Date elements rather than showing all the letters for the word "date."
Ex: "date : M-d-y" became "15am31America/Indiana/Indianapolis : Jan-15-2018" but what we wanted was "date : Jan-15-2018"

It was at this point that I got the bright idea to ESCAPE the letters by adding a BackSlash "\" infront of each letter. SURE ENOUGH!! Now I could see each letter instead of the date translation that each letter stood for.
So... I made this quick video to share with the world just incase someone else can benefit from this discovery!

p.s. I'm quite sure MANY have been using this "trick" for years. But I was excited to discover it on my own after a student brought the idea up! :-)

Link to video