Keyword

Display age in the present

  • saovry
  • saovry's Avatar Topic Author
  • Offline
  • New Member
More
1 week 6 days ago #178100 by saovry
Display age in the present was created by saovry
I have a question about Extract Field date on K2..

the Field of Date, user select the date and it can show the age.

Do you have any code of it?

If ueser select 10/02/2010, so the result will display " 11 Years OLd and 03 months"

thank..

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
1 week 5 days ago - 1 week 5 days ago #178116 by Fotis
Replied by Fotis on topic Display age in the present
Run this check in the foreach loop that prints out the extra fields:
<?php if($extraField->type == 'date'): ?>
This is the raw date value to format as you like >> <?php echo $extraField->rawValue; ?>
<?php endif; ?>

Then use PHP date formatting (www.php.net/manual/en/function.date.php) to render rawValue; ?> to anything you like.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 1 week 5 days ago by Fotis.

Please Log in or Create an account to join the conversation.

  • saovry
  • saovry's Avatar Topic Author
  • Offline
  • New Member
More
1 week 4 days ago #178139 by saovry
Replied by saovry on topic Display age in the present
Sorry, could you give me a little more guide..

Where could I pass this code into?
Where could I overwrite it when I update K2 so the code still in there. The code will lost..

thank u..

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
1 week 4 days ago #178151 by Fotis
Replied by Fotis on topic Display age in the present
If you know basic PHP coding, it should not be an issue for you to find the extra fields foreach loop and modify it to get the raw date value. If you need more explaining, then what you ask is beyond the support provided in this forum.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum