Date and Time function


#1

Hi there,

I have a question, how do we change a particular date into unix timestamp?
For example, I would like to change a particular date, maybe 12/07/1987 to a timestamp. Is it possible?
Well the reason for doing so is simple…I’m trying to build a simple script for my resume regarding to my age. I would like my age to “update” itself, without me to edit it each year.
My idea was to minus the timestamp of my birthdate to the current date. Then, just convert it to years, months, days, minutes and seconds.
I would be very greatful if someone could answer my initial question regarding on the timestamp, I have been searching for any function related to the function that I wanted but I only found the vice versa version of what i wanted, which is converting unix timestamp into a proper time format.

Thank you in advance.


#2

I thought resumes would list DOBs, rather than ages?
Anyway, I’m pretty sure you could have found mktime() if you’ve found date() on the PHP manual.


#3

The beautiful thing about http://php.net is that when you find a function related to what you want, generally on the left column, all the other related functions are there.

So when you go to http://us3.php.net/date which will tell you all about the date, you can see a list of the functions on the left where you will also find mktime as well. http://us3.php.net/mktime

I also find that if I scroll down past the technical stuff of the function, that there are many examples and comments that could also help direct and guide you to your solutions.

Good luck with your ventures.