Php - How to convert date to numbers or strings (strtotime)

Inleiding

When importing dates or timestamps out of mySql you might want to rank the dates on time. For this you ofcourse want to use numbers. It is a bit unclear on php.net to convert dates to numbers or strings. However, I found out by searching in forums and here is how to do it (very easy though)

Stappen

Just use the function strtotime

for example: $date='Fri, 04 May 2007 11:50:18 +0200'; echo $number=strtotime($date);

It will convert the date (and time!):

Fri, 04 May 2007 11:50:18 +0200

into a number like this:

1178272218