pub date |
[eluser]benfike[/eluser]
Hi! I have an problem.. I have a comment system and I have fields for it. create_date = when they send the comment. pub_date = create_date + 3 min Code: function submitComment(){ I already trying something like this, but it is dont work. It post 0000-00-00 00:00:00 .. Help pls. Thank you in advance.
[eluser]jmadsen[/eluser]
if you echo Code: $create_date = date("Y-m-d H:i:s"); you'll see you get a formatted date (ex., "2010-09-26 09:43:41"), so adding 180 to it doesn't make sense. There are two ways of adding onto dates, generally speaking: 1) convert your time to a timestamp and add 180 to that 2) break your date into its parts with date("Y"),etc; add +180 to the seconds part, then use mktime to turn it back into a formatted date. Dates are confusing to work with, but worth the time to get comfortable with. Start here http://php.net/manual/en/function.date.php and google a little for one of the many good tutorials on php date adding |
Welcome Guest, Not a member yet? Register Sign In |