• : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.
  • : Function split() is deprecated in /usr/local/pem/vhosts/104307/webspace/httpdocs/modules/profile/profile.module on line 285.

Drupal - Date Field, Remove 'All Day'

in

Q: How can I remove the 'All Day' text that is sometimes displayed at the end of a date?
A: Make a small addition to your theme's template.php file and theme it out of existence!

The Date module allows you to use a date field in your CCK types. When you create a date field you can specify its granularity, i.e. the precision to which it stores and manipulates date data. If you specify a granularity that includes time (Hour, Minute & Second) then the date field will contain, manage and display time along with the date.

The problem arises when you enter a date into such a date field but don't bother to specify a time - you leave it blank. In this case when the date is displayed, the text '(All Day)' will be displayed after it - this can be a real pain if you want the option of time in your date but don't want this text if the user doesn't specify a time!

So, you want time in your date format but don't want this label how do you get rid of it? You might expect there to be a setting to switch this off, but it seems that there isn't, the subject is discussed in some detail here:

http://drupal.org/node/367842

and here:

http://drupal.org/node/367842

To summarise, it seems that a good way to turn it off (altogether) is just to override a theme function. Edit you template.php and add the following code:

function <yourtheme>_date_all_day_label() {
  return '';
}

This themes the all_day label to nothing. This code is taken directly from the above posts - hats off to yee lads! Make sure to replace with your theme's name, and after making the change remember to clear your cache.

I wash there was a setting for this, but is seems there isn't, this theme change worked well for me! If anybody knows of a better way of handling this please let us know!!

Stranger
Stranger's picture
Thank you!

Thank you worked for me

Joined: 08/01/2009
User offline. Last seen 23 weeks 3 days ago.
No probs, glad you found the

No probs, glad you found the info of use!

Stranger
Stranger's picture
Thanks for explaining the solution!

Been looking to remove thon "all day" stuff for a while!

Stranger
Stranger's picture
Thanks

Hi This is vijai from india thanks for ur information

Stranger
Stranger's picture
Thanks

Thanks, this worked for me. However, I did have to remove the "_label"; once I did that it worked perfectly!

Joined: 08/01/2009
User offline. Last seen 23 weeks 3 days ago.
I am glad that this post has

I am glad that this post has helped out some drupalers out there, I wonder does anybody know if the lads over at Drupal Date are planning to make this an admin setting anytime soon?

I love coding more than most but I still reckon the more web designing and building we can get done without having to roll up our codong sleeves the better!

Stranger
Stranger's picture
seems like the granularity of

seems like the granularity of data stored for date(time) fields is the reason for display of 'all day': if value entered is missing hours/min/seconds while granularity saves hours/minutes/seconds, value stored is interpreted as 'all day'. setting granularity to day/month/year (and un-setting timezone adjustments) seems to avoid output of 'all day' string.

Joined: 08/01/2009
User offline. Last seen 23 weeks 3 days ago.
Hi, thanks for the info - I

Hi, thanks for the info - I must check it out!

K.

Stranger
Stranger's picture
thanks

thanks a lot

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Pride on FacebookPride on TwitterPride on TwitterPride on Twitter

Join Our Newsletter

* indicates required

Irish Internet Association

phone-number.png