WordPress.org

Ready to get started?Download WordPress

Forums

How to add space between date and time in php? (6 posts)

  1. okaprasumba
    Member
    Posted 1 year ago #

    my post date code is <div class="post-date"><?php the_time('j M Y H i'); ?></div> and it will show for exmple : 14 apr 2013 11.30. how to create space between the date (14 apr 2013) and time (11.30) so it can show like this : 14 apr 2013___11.30 ??
    i'm new in wordpress and i dont know anything about php so please somebody help me :(

  2. I would start by looking at this -
    http://codex.wordpress.org/Formatting_Date_and_Time
    and then perhaps split the date and time in 2 php functions separate by a spacer or some sort.

    <div class="post-date"><?php the_time('j M Y'); ?>,   &nbsp <?php the_time('H i'); ?></div>

  3. okaprasumba
    Member
    Posted 1 year ago #

    thanks Christine, its working :)
    but how to add more then one space to it?

  4. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Double spaces may be stripped...try a divider:

    <div class="post-date"><?php the_time('j M Y'); ?>, &nbsp|&nbsp<?php the_time('H i'); ?></div>

  5. okaprasumba
    Member
    Posted 1 year ago #

    its not working.. its show like this : 14 apr 2013 | 11.30
    is there any other way to add the space?

  6. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    I would look at what style(s) are associated with the element(s) and add some padding or margin...use CSS...

Topic Closed

This topic has been closed to new replies.

About this Topic