I have som problems with the date functions in wordpress.

I am trying to get different format on the post date on some pages and i have been trying "the_date()","the_time()" and "echo get_the_date()". They all behave in the same way.

They output the correct date format when i just type for example the_time(). The output is the format i had setup in wordpress settings, as expected.

The problems is that when i try to format the output by ex: the_time('d') the output is "d" or echo get_the_time('F j, Y'); the output is "'F j, Y'".

I forgot to mention that the code is inside "the loop"

This is my page.php

<?php get_header();?>
<?php get_sidebar('subnav');?>
<section class="main-content2" id="page">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title();?></h1>
<?php the_content();?>
<footer class="meta">Publicerades den <?php echo get_the_date('d');?></footer>

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php get_footer();?>    

I cannot understand what the problem is, please help!:)

  • It should work, I guess. I don't see anything wrong with your code. Disable all plugins and check if this error still exists. Maybe some plugin is breaking things up. Commented Jul 27, 2013 at 12:15

3 Answers 3


When using date function it is recommanded to use date format or time format of the installation :


This allows you to grab date format or time format of the current installation.

  • 2
    I guess Hiren knows that, but he want's to get different date format on some of pages. You can't do it with date format option. Commented Jul 27, 2013 at 12:13
  • ok, I see. In this case this should work.
    – JMau
    Commented Jul 27, 2013 at 12:17
  • I have no problem getting the standard format. The problem occurs when trying to get a different date format. Commented Jul 27, 2013 at 12:18
  • The problem is now solved. The problem was with qtranslate, which was setup to use strftime instead of date. Commented Jul 27, 2013 at 12:34

Use emulated date function

You need to choose "Use emulated date function.", not "Use strftime instead of date"


The main reason why the_time not working is that you are inputting date formats(05/01/2015) in the_time, which is specifically for time (5:00 pm).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.