Articles


How to handle Drupal 7 date field styling for date month and year separately.

How to handle Drupal 7 date field styling for date month and year separately.



Posted byJibin Jose,30th Apr 2016

For one of my drupal site need to display a upcomming events and the events list need to display the date and month. The date need to be there above the month and date needs a separate styling also. 

For the same we need to create the view for showing the event list. Also add the necessary fields for the views as per our requirements. 

Go to "admin/config/regional/date-time/formats" there we can find the options to add new formatts for our own. I have add a new format one for showing the date alone and one for showing the month.

Also we need to add new date type with the new format. Go to "admin/config/regional/date-time" for adding the new date type. For my case I add two types one for listing the date and one for the month.

Go to the views and add the date field as the views field (Content: Date) and there we can found the option "Choose how users view dates and times:". Inside that select the date type we need for the date.

Again add a new field  (Content: Date) for listing the month along with the styles. Follow the same steps to choose the listing type as above. 

Now we will get to separate fields as date and month, there we can style these fields separately. 

If you found any difficulty in building the same. Please feel free to get in touch with us.

Related Articles