Welcome Guest, Not a member yet? Register   Sign In
PHP Questions About Date
#11

[eluser]CodeIgniterNewbie[/eluser]
As a "date?" What do you mean by that? Are you referring to PHP's date function? If so, then you run into the Unix Epoch problem.
#12

[eluser]Sean Murphy[/eluser]
megabyte is talking about database datatypes, but you, CodeIgniterNewbie, said you're only concerned with the PHP side of things.

megabyte, as far as I know, the most compelling reason for storing dates in the DB as an INT (unix timestamp) is that it can be significantly faster to compare dates when your dataset is large. Also, some don't like to deal with the MySQL datetime to PHP timestamp conversion.

Now, I could be wrong but, looking at the documentation, it looks like PHP 5 added the DateTime object to solve the unix timestamp problem. http://us.php.net/manual/en/function.date-create.php
#13

[eluser]CodeIgniterNewbie[/eluser]
Is DateTime better than strtotime? Does it store dates prior to 1901? Got snippet?




Theme © iAndrew 2016 - Forum software by © MyBB