WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!:)

share|improve this question
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. – Krzysiek Dróżdż Jul 27 '13 at 12:15

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.

share|improve this answer
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. – Krzysiek Dróżdż Jul 27 '13 at 12:13
ok, I see. In this case this should work. – JMau Jul 27 '13 at 12:17
I have no problem getting the standard format. The problem occurs when trying to get a different date format. – Hiren Kerai Jul 27 '13 at 12:18
The problem is now solved. The problem was with qtranslate, which was setup to use strftime instead of date. – Hiren Kerai Jul 27 '13 at 12:34

Use emulated date function

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

share|improve this answer

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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