How do I get timestamp from e.g. 22-09-2008
?
Be careful with functions like strtotime()
that try to "guess" what you mean (it doesn't guess of course, the rules are here).
Indeed 22-09-2008
will be parsed as 22 September 2008, as it is the only reasonable thing.
How will 08-09-2008
be parsed? Probably 09 August 2008.
What about 2008-09-50
? Some versions of PHP parse this as 20 October 2008.
So, if you are sure your input is in DD-MM-YYYY
format, it's better to use the solution offered by @Armin Ronacher.