Jump to content

gageorion

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gageorion's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. SOLVED MY OWN PROBLEM. For others that may possibly need an answer.... <?php $tdate = date('d M'); $createddate = strtotime($item->created);$cdate=date("d M",$createddate); ?> <?php if($tdate == $cdate): ?> <span class="moduleItemDateCreatedToday"> <?php echo JHTML::_('date', $item->created, JText::_('<span class="day">%d</span><span class="month">%b</span>')); ?></span> <?php else:?> <span class="moduleItemDateCreated"> <?php echo JHTML::_('date', $item->created, JText::_('<span class="day">%d</span><span class="month">%b</span>')); ?></span> <?php endif; ?> $item->created is a date from the database in the format y-m-d h:m:s. I only wanted to compare the day and month, I am using a 'd M' (01 Jul) format. By converting the format of $item->created to the "d M" format, I simply compared the two. Now the current day's posts are highlighted in a different color. May not be a big deal to you code wizards, but i didn't know crap about PHP a few hours ago. Thanks.
  2. ADDING TO PREVIOUS POST. I should have learned more before posting... <?php if($params->get('itemDateCreated')): ?> <span class="moduleItemDateCreated"> <?php echo JHTML::_('date', $item->created, JText::_('<span class="day">%d</span><span class="month">%b</span>')); ?></span> <?php endif; ?> By adding this, <?php echo $item->created; ?> i can display the date in this format. 2011-07-03 05:13:29 so $item->created is the date I want to compare to today's date. I will get it eventually. Thanks!
  3. Thanks for the response mikesta707! I have included an image of the output. The output WAS in this format Sunday, 26 June 2011 22:59 until I figured out how to use the %d %b to output what you see in the image, a 2 integer date and abbreviated month. Currently there is an external style sheet, but I can just include it in the PHP with if / else statement... just need to get that far. Does that help? Like I said, Im a noob. Thanks! [attachment deleted by admin]
  4. Hey Guys, I am not a dev, just a designer, so forgive the stupid question...this is rocket science to me, not for you, so thank you! I need to have the date stamp change colors if it is today's date. I have started, but I will not embarrass myself with the slop I have been attempting. Here is what I do have, which simply returns the created date. I want to hi-light todays posts. <span class="moduleItemDateCreated"> <?php echo JHTML::_('date', $item->created, JText::_('<span class="day">%d</span><span class="month">%b</span>')); ?></span> Thanks geniuses. (I am going to school to learn web dev, just not there yet.)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.