Hi does anyone know what the problem is met this code .
there is no result except when I give 2015 as the year of birth .
He also calculated no age
foreach ($users as $user) {
$user = ossn_user_by_guid($user->guid);
$today = date('d/m/Y');
$user->birthdate;
$interval = date_diff($today, $user->birthdate);
if ($today == $user->birthdate) {
echo 'today is ' . $user->username . 'birthday (' . $interval . ')';
} else {
echo "";
}
}
@christiaan pot can you send your plugin as file or host it in github so that we can check with that
I'll create a birthdate component , which shows brithdays of friends, in few days.
I dont understand
like this?
<?php
$user->username;
$user->birthdate;
$date1=datecreate($user->birthdate);
$date2=datecreate(date('Y/m/d'));
vardump($date1);
$diff=datediff($date1,$date2);
if ( $date1 == $date2)
{
echo 'today is ' .$user->username. ' birthday (' .$diff->format("%R%a"). ')';
}
else
{
echo '';
}
?>
<?php
$date1=date_create("1989/12/26");
$date2=date_create(date('Y/m/d'));
var_dump($date1);
$diff=date_diff($date1,$date2);
echo $diff->format("%R%a days");
?>
Your not passing the value correctly
in
date_diff
you have to pass with time also verify this .
http://php.net/manual/en/datetime.diff.php
or pass like this
<?php
$date1=date_create("1989/12/26");
$date2=date_create(date('Y/m/d'));
var_dump($date1);
$diff=date_diff($date1,$date2);
echo $diff->format("%R%a days");
?>
I try to show the birthdays
with the ages behind it.
but he shows them only when the year is equal to now
What are you trying to achieve ?
Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.
$199 (Life Time)