Benchmark: strtotime() vs DateTime vs getTimestamp in PHP

Recently I wrote about how one can implement date comparison in PHP. In the article I presented two approaches. Firstly, using the strtotime() method and another with the DateTime class.
Then, in the comments on the german division of this blog, it was pointed out that the strtotime() variant is probably faster. Because I wasn’t sure about this, I decided to make a small performance test and share the results with you in this article.
How did I test the performance?

Since the question aims on strtotime() vs. DateTime, the DateTime class is contrary to the strtotime() function. So because DateTime class offers more functionality, I had first to create the DateTime object and then get the timestamp of it, because the strtotime function gives a timestamp as return value and I wanted to compare the time needed to generate the identical output.
As input I have taken a date without a custom time […]

How to convert C# DateTime.Ticks into Unix timestamp

C# DateTime.Ticks ConverterWith the .NET frameworks DateTime functions you can do a lot of nice things. The handling turns out, in my opinion, very pleasant. The only requirement: You find yourself in a pure .NET environment. When other systems come into play, the trouble begins. But why is it that you can not compare DateTime.Ticks with the PHP mktime()-function?
If you request the “timestamp” from a DateTime-object (DateTime.Ticks), so you get back the number of ticks since 01.01.0001 00:00. A tick in turn is 100 nanoseconds long.
A Unix timestamp, as produced by mktime() for example, is to the contrary, the number of seconds since 01/01/1970. A direct comparison is not possible. So you have to convert between the both units at first. And how to do this, is what I want to show you today, based on a few […]