sql-filter in lists

18 years 4 months ago #3189 by ericmuc
sql-filter in lists was created by ericmuc
Hi,

Who knows the sql-string, to get the age out of the birthday date?

I have the field birthday and want to list all user with various ages. Can I use some sql-snytax in the advanced filter field in the list page?

Best regards
Eric

Please Log in to join the conversation.

18 years 4 months ago #3238 by Caspar
Replied by Caspar on topic Re:sql-filter in lists
Hi,

you need a little peace of code to do that.
This is something I wrote for me. Maybe you can adapt this for yourself. If you need further help, just make a post here or PM me.

[code:1]function birthday($theday)
{
$DOBArray = explode("-", $theday);
//echo $DOBArray[1].".".$DOBArray[2]."<br>";
$bday = $DOBArray[2].".".$DOBArray[1];

if ($bday==date("d.m"«»))
{
$a = date(Y);
$b = $DOBArray[0];
$x = ($a - $b);

return $x;
}
else
{
return "";
}
}[/code:1]

Do me a favour an go to www.st-sebastian-beckum.de and click on the green image, which says TOP 50 and vote for the page. Thanks!

Please Log in to join the conversation.

18 years 3 months ago #3322 by ericmuc
Replied by ericmuc on topic Re:sql-filter in lists
Hi, thanks a lot, I will test it in the next days!
Eric

Caspar wrote:

Hi,

you need a little peace of code to do that.
This is something I wrote for me. Maybe you can adapt this for yourself. If you need further help, just make a post here or PM me.

[code:1]function birthday($theday)
{
$DOBArray = explode("-", $theday);
//echo $DOBArray[1].".".$DOBArray[2]."<br>";
$bday = $DOBArray[2].".".$DOBArray[1];

if ($bday==date("d.m"«»))
{
$a = date(Y);
$b = $DOBArray[0];
$x = ($a - $b);

return $x;
}
else
{
return "";
}
}[/code:1]

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.204 seconds

Facebook Twitter LinkedIn