Jump to content

Calculating age from date of birth. Also time zone issues.


pthurmond

Recommended Posts

Are there any functions for calculating someones age from their date of birth in php? I don't suppose it would be as easy as subtracting their date of birth from the current date.

Also I need to be able to record time from the users time zone for signin times. Any suggestions as to how to get the time for their time zones?

Oh and does php have any pre-designed functions to convert time from the hour:min AM/PM format to military time?


Thanks,
Patrick
All your answers are here:

http://sg.php.net/manual/en/ref.datetime.php

I would recommend checking out date() and strtotime(), and have a read of the comments below.  Many people have posted useful code in the comments.

Edit: As for time zones, the forum software I've seen asks the user for their time zone on registration :)  A lot try to guess the time zone with geolocation stuff, which I know little about.. but it seems quite effective.

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.