relative dates? |
[eluser]xwero[/eluser]
I'm not sure if the strtotime function parses the mysql dateformat correct. According to the manual it expects the US english date format. Do you have other experiences?
[eluser]Mark van der Walle[/eluser]
I have been using that often. Just tested it again and it works like a charm
[eluser]Derek Allard[/eluser]
Well I'll be... Mark, nice tip. PHP.net usernotes warn that this didn't work prior to PHP 5. Can you comment on that?
[eluser]delay[/eluser]
I was just looking at doing something similar. There is a good function that handles this on the php site. http://us.php.net/time Look for the "timeDiff" function. It will do exactly what you want. You can also easily convert your mysql dates into the timestamp formats it needs by loading the date helpers. Code: $this->load->helper('date'); Code: $TimeAgo = $this->timeDiff($unixdate,false, 1, minute);
[eluser]Gordaen[/eluser]
[quote author="jvittetoe" date="1196845301"]one more thing, how can i convert a mysql timestamp into a unix timestamp.[/quote] You can do that at the database with MySQL's UNIX_TIMESTAMP() function or else load CI's date helper and use mysql_to_unix(). As far as the discussion about intelligent defaults, I think using the largest two units makes the most sense for defaults, but configurability would be nice. |
Welcome Guest, Not a member yet? Register Sign In |