Syndicate

Feed

No time of day in node date

It is common to wish to remove the time of day shown in the node “submitted” line. In Drupal 5, there were no less than three ways to achieve this, and I will present these when I'm done covering date formatting for Drupal 6. Drupal 6 allows you to modify the different formats for dates in the Administration area of your site, these different formats being small, medium and large — yep, just like pizza, oh... my... god... You could do the same in Drupal 5. However, you then had to pick among a finite list of options. In Drupal 6, you can create an nth option, if you like none of the options presented to you.

It is the medium-size date format that's used to format the submitted line in nodes, as shown in lines 2449-2460 of modules/node/node.module:

/**
 * Format the "Submitted by username on date/time" for each node
 *
 * @ingroup themeable
 */
function theme_node_submitted($node) {
  return t('Submitted by !username on @datetime',
    array(
      '!username' => theme('username', $node),
      '@datetime' => format_date($node->created),
    ));
}

In Drupal 6, the signature of the Drupal function format_date() is:

format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL)

When the 2nd parameter is not set, 'medium' is used to format the date, and the function theme_node_submitted() is not setting that 2nd parameter when calling format_date().

To modify the medium-size format for dates, head over to the page admin/settings/date-time of your Drupal site. Under Formatting, in the drop-down list of options for “Medium date format:”, you will find a “Custom format” option. Select it. There was no such option in Drupal 5. Note that in Drupal 6 — just like in Drupal 5 — all the preset options still show time of day for the medium-size date.

In Drupal 6, the Medium date format now shows a custom format option.

Look for the preview of the current date in the text below the field on the right, where it says: This format is currently set to display as...

(Take note also that a link to the PHP manual is provided to you, to show you how to format dates in PHP.)

In Drupal 6, the default Medium format is D, m/d/Y - H:i

If all you want to do is remove the time of day from your current default, get rid of the - H:i part. Then do a Save configuration.

Your new Medium date format.

Now if you look at any node on your site, you will see that the change has taken effect immediately: no more time of day.

No more time of day in nodes.

If you do not see the change, it can mean either of these two things: your theme is overriding the function theme_node_submitted(), or, the function format_date() is called within your node template file, in your theme, with some custom format, to display the date.

In Drupal 5

In Drupal 5, there were at least three ways of going about changing your date format.

  1. Use template.php (http://drupal.org/node/209793#comment-697884) to modify the variable $submitted. Like so:

    function _phptemplate_variables($hook, $vars) {
      switch($hook) {
        case 'node' :
          $vars['submitted'] = t('Submitted by !username on @date', 
            array(
              '!username' => $vars['name'],
              '@date' => format_date($vars['node']->created, 
                                      'custom', 'l, j M Y'),
            ));
          break;
      }
      return $vars;
    }
  2. Modify your site's settings.php file (http://drupal.org/node/134990#comment-221129) — to change your system's default medium format. Thank you, Mooffie. So you un-comment the $conf array and add one line to it, like so:

    $conf = array(
    #   'site_name' => 'My Drupal site',
    #   'theme_default' => 'minnelli',
    #   'anonymous' => 'Visitor',
        'date_format_medium' => 'D, m/d/Y',
    );
  3. Modify node.tpl.php (http://drupal.org/node/134990#comment-221973) — instead of printing $submitted, you print $node->created formatted. Like so, for example:

    print format_date($node->created, 'custom', 'l, j M Y');
Last edited by Caroline Schnapp about 8 years ago.

Comments

Helpful!!

I am working on a project and this code (even snapshots) will surely help me. Thank you for sharing.

Nodes

I always struggle with these node issues.

How to insert this code

How to insert this code please

function _phptemplate_variables($hook, $vars) {
switch($hook) {
case 'node' :
$vars['submitted'] = t('Submitted by !username on @date',
array(
'!username' => $vars['name'],
'@date' => format_date($vars['node']->created,
'custom', 'l, j M Y'),
));
break;
}
return $vars;
}

There are many types of

There are many types of coding that you can copy from many sources available on the internet is that you can make it easier to create the look of a time away. Joyetech eCab

It can indeed be one of the

It can indeed be one of the coding if read by a lay person and he will be confused. It had to be read by people who know programming languages​​. painters sacramento

I always find such amazing

I always find such amazing posts on this website and today's post was really amazing. Thanks dude black cigarettes

Thanks for this

That's a really great tutorial indeed. I was confused about changing the date format in Drupal but after this I think I can do it.

Drupal could be a free and ASCII text file

Drupal could be a free and ASCII text file content management framework (CMF) written in PHP and distributed underneath the antelope General Public License.[3][4][5] it's used as a back-end system for a minimum of a pair of.1% of all websites worldwide[6][7] starting from personal blogs to company, political, and government sites as well as whitehouse.gov and knowledge.gov.uk.[8] it's conjointly used for information management and business collaboration.hostel nyc

clear explanation of issues

Very open and very clear explanation of issues. Thanks for sharing. Looking forward to more! Your writing is simply amazing and I prefer to read quality content, I will gladly bookmark your site and come back for more.

this is my new comment

Drupal could be a free and ASCII text file content management framework (CMF) written in PHP and distributed underneath the antelope General Public License.[3][4][5] it's used as a back-end system for a minimum of a pair of.1% of all websites worldwide[6][7] starting from personal blogs to company, political, and government sites as well as whitehouse.gov and knowledge.gov.uk.[8] it's conjointly used for information management and business collaboration

Nice and clean blog !!

The blog is genetically published for good article. I could not know how to customize a blog. can any body answer my question, In a blog great full tutorial indeed and I found that. Thanks......... Rent my flat

how to modify

how to modify the medium-size format for dates? When the 2nd parameter is not set, 'medium' is used to format the date, and the function theme_node_submitted() is not setting that 2nd parameter when calling format_date().

ipad applications

cleaning in san diego

This is an interesting and so well maintained blog. Whole article is too good and well written.

This is just great. I like

This is just great. I like it.

Social Media Application Developer

Tax attorney

We are really grateful for your blog post. You will find a lot of approaches after visiting your post.

voip

Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up. Wow, this is pretty interesting. Inspiring, as well. Thanks for sharing such inspiring experience with us. Great blog, congrats.!

Worth Bookmarking

Bartley Ridge facilities provide full family entertainment needs for your family and loved ones. Indulge in a serene and tranquil lifestyle right in the heart of Bartley.
Bartley Condo

Excellent and decent post. I

Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up. Wow, this is pretty interesting. Inspiring, as well. Thanks for sharing such inspiring experience with us. Great blog, congrats.! e-papierosy

To modify the medium-size

To modify the medium-size format e-papierosy for dates, head over to the page admin/settings/date-time of your Drupal site. Under Formatting, in the drop-down list of options for e-papierosy “Medium date format:”, you will find a “Custom format” option. Select it. There was no such option in Drupal 5. Note that in Drupal 6 — just like in Drupal 5 — all the preset options still show time of day for the medium-size date.

best treadmill for home use

I found lots of interesting information here. The post was professionally written and I feel like the author has extensive knowledge in this subject.

writing the right things

This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck

Jewelry Toronto

Really informative blog post here my friend. I just required commenting & say maintain the quality work. I’ve bookmarked your blog just now and Ill be back to read more in the future my friend! Also pleasant colors on the layout it goes well with the blog in my modest opinion.

awesome tree

That is very interesting

That is very interesting Smile I love reading and I am always searching for informative information like this. This is exactly what I was looking for. Thanks for sharing this great article

http://www.buyuniquegifts.net/

That is very interesting Smile I love reading and I am always searching for informative information like this. This is exactly what I was looking for. Thanks for sharing this great article Birthday Gifts are not always about cake and flowers.

excellent post

Belgravia Villas is a new and upcoming cluster housing located in the Ang Mo Kio area, nested right in the Ang Mo Kio landed area. It is within a short drive to Little India, Orchard and city area. With expected completion in mid 2016, it comprises of 118 units in total with 100 units of terrace and 18 units of Semi-D. Future residents are within a short driving distance to Ang Ko Kio Hub and Compass Point. With such a short drive to the city area as well as the orchard and bugis area, entertainment for your love ones and family will come at a stone’s throw away.
Ang Mo Kio Cluster House

Celine Bag UK

This set of uniforms, including uniform jacket, breeches, boots, officers belt, military coat and with a dark gray woolen Buqiong Ni cap.

Nice post

awesome post related to this...
search doctor online and book appointment with them free with DoctorSaabHai.com..
Visit once to know more about this..

Hi

We are really grateful for your blog post. You will find a lot of approaches after visiting your post.

Social Media Application Developer

Cheap Nike Blazers

pipe thoo de fence, lyin’ inside, and I jes’ reached thoo with a piece o’ boad I found dey and pulled it over to me an’ tuck it. An’ aftahwahd dis Mistah Watchman man

movies on demand

"Oh yes, the past can hurt. But you can either run from it, or learn from it."

movies online

The truth is... I gave my heart away a long time ago, my whole heart... and I never really got it back..

submit node

This "submit" is also a difficult problem for me, now solved by you, thank you, and i have a online sex toys shop(best sex toys), hope your coming.

idraetsefterskole

Wow, this is pretty interesting. Inspiring I found your website perfect for my needs. Thanks for sharing the great ideas.

apply here

I really liked the blog nice work keep it up!.

payday loans

I have saved the blog to amy bookamarks liked it very much.

Excellent

However, you then had to

However, you then had to pick among a finite list of options. In Drupal 6, you can create an nth option, if you like none of the options presented to you. http://e-papierosy.weebly.com/
http://lubietopale.blox.pl

I am so happy to read this.

I am so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that's at the other blogs. Thanks for sharing

Ecopolitan EC will be

Ecopolitan EC will be accessible with Punggol MRT Station as well as Punggol Bus Interchange. It is also right beside Tampines Expressway(TPE). Ecopolitan EC is also near to Marina Country Club, Sengkang Riverside Park and Sheng Siong hypermart in Punggol Central.
Ecopolitan

A Web Directory

Welcome to googlezebra - a web directory, you can submit your link here as well as discuss on googlezebra forum.

Welcome to google Zebra Forum

hi all,

Welcome to google Zebra Forum

paternity tests

Excellent, what a website it is! This blog provides valuable facts to us,
keep it up

Jewel at Buangkok is a new

Jewel at Buangkok is a new and upcoming condo located in Buangkok Drive and Sengkang Central area, within a short walk to Hougang Green Shopping Mall and a short drive to Compass Point. With expected completion in mid 2016, it comprises of TBA towers with TBA units and stands TBA storeys tall.
Jewel at Buangkok

Power Click

This great blog is very interesting and enjoyable to read. I am a big fan of the subjects discussed. I also enjoy reading the comments, but notice that alot of people should stay on topic to try and add value to the original blog post. I would also encourage everyone to bookmark this page to your favourite service to help spread the word.

For vehicle owners, it takes

For vehicle owners, it takes less than 30 minutes to drive to the business hub and vibrant Orchard Road shopping district, via Tampines Expressway (TPE), Central
Expressway (CTE) and Kallang-Paya Lebar Expressway (KPE)
Coraledge Residences

richardreed

We are actually very thankful for your blog post.

wholesale direct metals

This is a remarkable post.

This is a remarkable post. This post gives truly quality information. I'm definitely going to look into it. It provides very useful tips. Thank you so much for sharing this post.

This is a remarkable post.

This is a remarkable post. This post gives truly quality information. I'm definitely going to look into it. It provides very useful tips. Thank you so much for sharing this post.
Corals Daniel Libeskind
video on medini

It's great to be here and

It's great to be here and meet new friends, welcome to our zone to find out your favorite heels. Please don't hesitate to contact me if you have any request.

I like this blog so much.

This is an interesting and so well maintained blog. The post was professionally written and I feel like the author has extensive knowledge in this subject.

I like the post! Outstanding

I like the post! Outstanding job! Keep discussing such useful details through your weblogs. Thanks!

The blog was absolutely

The blog was absolutely fantastic! Lots of great information which is often attractive some and the other way. Keep updating the blog, impatient for more contents…Great job, continue.. Online Games

The Panorama has full and

The Panorama has full and unique facilities, which includes a guard house, clubhouse, children's playground, swimming pool, piano room, pool room, indoor gym, hydrotherapy beds, hydrotherapy baths, reading room, function room, onsen, jacuzzi. ang mo kio The Panorama

The condo’s facilities

The condo’s facilities provide full family entertainment needs for your family and loved ones. Indulge in a serene and tranquil lifestyle right in the heart of Changi. The Inflora

nice share

nice share and my doubs are cleared, thanks for sharing

i am very glad that i gound this post. let the poll begin, i am very exited to take part..
thanks for sharing.. omegle spy cam

I'm just starting up my own

I'm just starting up my own blog and only hope that I can write as well and provide the reader so significantly insight.

Different dogs require

Different dogs require different forms of dog grooming. Also, the length of each grooming is different across different breeds. Also, across different breeds, the instruments needed to groom the dog will be different. Dog Grooming singapore

Dina J. Ely

I will be focusing on a project and also this code (even snapshots) will really guide me personally.Dina J. Ely Appreciate it with regard to sharing.

It is situated right beside

It is situated right beside Layar LRT Station. Future residents will be able to access the nearby Compass Point and Greenwich V which is a short drive away for some family fun and gatherings. A truly unique lifestyle awaits you. Riverbank Fernvale

remove scrycpt injection

howto to remove an injection at our host database ?

rent a car at jogja

we used an emergency form to pick up your landing plan.. at sewa mobil jogja - rental mobil jogja

prambanan trans new agen car rental in jogja

someday if you came to jogja indonesia, we will glade to give you an special service rent car sewa mobil jogja

the first car rental service in jogja indonesia

we share and we will take off your plan came to jogja sewa mobil murah di jogja

Boardwalk Residences in Sengkang Fernvale Close

Boardwalk Residences is a 99-years leasehold private condominium development located at Sengkang West Way / Fernvale Link in District 19. With expected completion in mid 2017, it comprises of TBA towers with estimated 590 units and stands TBA storeys tall. Boardwalk Residences

Boardwalk Residences in Sengkang Fernvale Close

Boardwalk Residences is a 99-years leasehold private condominium development located at Sengkang West Way / Fernvale Link in District 19. With expected completion in mid 2017, it comprises of TBA towers with estimated 590 units and stands TBA storeys tall. Boardwalk Residences

Several buses are available

Several buses are available near Lakeville along with shopping centers and restaurants. Lakeville is also near to Jurong Lake Park and The Japanese Garden. Entertainment for your loved ones and friends is therefore at your fingertips with the full condo facilities as well as the amenities near Lakeville. new property launches

The condo’s facilities

The condo’s facilities provide full family entertainment needs for your family and loved ones. Indulge in a serene and tranquil lifestyle right in the heart of the city. http://highlineresidence.net

The condo’s facilities

The condo’s facilities provide full family entertainment needs for your family and loved ones. Indulge in a serene and tranquil lifestyle right in the heart of Tampines. new condo for sale