date() doesnt respect the timezone and language settings for drupal users. Plus I guess it isn't Drupal coding standard to use date(). So you should use Drupals own date function: format_date()
In node--teaser.tpl.php change
<div class="teaser-created-month">
<?php print date('M',$node->created); ?>
</div>
<div class="teaser-created-day">
<?php print date('d',$node->created); ?>
</div>
to
<div class="teaser-created-month">
<?php print format_date($node->created,'custom','M'); ?>
</div>
<div class="teaser-created-day">
<?php print format_date($node->created,'custom','d'); ?>
</div>
Comments
Comment #1
Thremulant commentedHi, I'm having a problem with this code, I hope you can help me:
BUT, when I go to the page, this is what is displayed:
MAR, 07/28/2015 - 16:20
JUL
31
2015
Why is this showing the wrong month and date?????
Thanks,
Daniel.
Comment #2
dagomar commentedWell, is the $date variable created with $node->created, or with something else?
Comment #3
gaurav.kapoor commentedDid changes as suggested in comments.
Comment #4
gaurav.kapoor commentedComment #5
bhumikavarshney commentedThe above patch use Drupal coding standard for date().
Comment #7
gaurav.kapoor commented