Jump to content

Most effiecnt way to work in a b-day


xcandiottix

Recommended Posts

So i'm working on a submission form and I'd like to get users birthday. Afterwards though I would like a php script to be able to kick back that X user is X years old. I have a javascript form built that has a drop down for each month, day, and year. When I save it to the database whats the best way to do it so that php can easily relate that to a year of age. I know there's a lot of date functions in php but i'm confused as to the best way to go about it. I'm thinking:

 

Javascript outputs to mysql 11091982 (11/09/1982)

PHP takes todays date ... can i use date(m,d,y)? and subtracts 11091982 and comes up with $age=27 ??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/204308-most-effiecnt-way-to-work-in-a-b-day/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.