How to create Birthday calender In php

when user enter birth date then it shoul be calculate year month and day with time.

1 Like

Have a look at the date and datediff functions.

<?php
$today = new DateTime();
$birthday = DateTime::createFromFormat('m-d H:i:s','11-22 23:59:00');
$diff = $today->diff($birthday);
echo $diff->format('%d days %h hours %i minutes %s seconds left');

Only Year is correct …but month and day and time is not correct…so could you please tell me the all code of that.

I see no year in

What does the code you tried look like?

Are you having any problems understanding

http://php.net/manual/en/datetime.createfromformat.php

or is it

http://php.net/manual/en/datetime.diff.php

you’re having trouble with?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.