Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7755783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:39:02+00:00 2026-06-01T12:39:02+00:00

This is the php code for date format on my web page function starkers_posted_on()

  • 0

This is the php code for date format on my web page

 function starkers_posted_on() {
    printf( __( 'Posted on %2$s by %3$s', 'starkers' ),
        'meta-prep meta-prep-author',
        sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a>',
            get_permalink(),
            esc_attr( get_the_time() ),
            get_the_date('Y-m-d'),
            get_the_date()
        ),
        sprintf( '<a href="%1$s" title="%2$s">%3$s</a>',
            get_author_posts_url( get_the_author_meta( 'ID' ) ),
            sprintf( esc_attr__( 'View all posts by %s', 'starkers' ), get_the_author() ),
            get_the_author()
        )
    );
}

it gives this

 Posted on <a href="#" title="23:50" rel="bookmark">
       <time datetime="2012-03-31" pubdate="">March 31 2012</time>
       </a> by <a href="#" title="View all posts by me">me</a>

What I want is to wrap Month, date, and year separately inside divs like this only on the main page:

<div class="month">March</div>
<div class="date">31</div>
<div class="year">2012</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:39:03+00:00Added an answer on June 1, 2026 at 12:39 pm

    You can do this by passing in a format string parameter into the get_the_date() function like this:

    You could do something like this:

    sprintf('<div class="month">%s</div>', get_the_date('F'));
    sprintf('<div class="date">%s</div>', get_the_date('j'));
    sprintf('<div class="year">%s</div>', get_the_date('Y'));
    

    UPDATE

    Or like this in your index.php file (from your themes folder):

    <div class="month"><?php get_the_date('F'); ?></div>
    <div class="date"><?php get_the_date('j'); ?></div>
    <div class="year"><?php get_the_date('Y'); ?></div>
    

    The format strings use here are as follows:

    • F = Month (as a word)
    • j = Day of the month (number)
    • Y = Year (as 4 digits)

    Check the docs here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This PHP code... 207 if (getenv(HTTP_X_FORWARDED_FOR)) { 208 $ip = getenv('HTTP_X_FORWARD_FOR'); 209 $host =
Say i have this PHP code: $FooBar = a string; i then need a
I have this php code, with which I am trying to generate a popup
I have this PHP code echo '<a href=# onclick=updateByQuery(\'Layer3\', ' . json_encode($query) . ');>Link
I am using this php code: exec(unrar e file.rar,$ret,$code); and getting an error code
I found this PHP code in an app I have to modify... $links =
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
I have this bit of code in a .php file: <?php ec3_get_events( 5, //
I have this code that generates a WP menu: <div id=menu> <?php $args =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.