I am using the Date module together with a view to display dates, and I need to get the date timestamp. The problem is that $fields['date_in_timestamp'] content comes wrapped in HTML.

<span class="date-display-single"> 1468473300 </span>

I need only the value and no HTML.

PS: my field "date_in_timestamp" will apply a "U" format for the timestamp.

One possible way I found is described in https://www.drupal.org/node/423870, comment #9. The problem is that this applies to all those who have a certain format, and I don't know how to distinguish them from other similar formats.

Is there any way to get the machine name of the date format?


The solution that worked for me in this case was easier than I thought.


In the configurations of the view

1.- Select settings Style -> Customize HTML field -> None

  • Uncheck Add default classes

2.- In Rewrite results -> Select Strip HTML tags

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.