Welcome Guest, Not a member yet? Register   Sign In
Easy Time Question
#11

[eluser]xwero[/eluser]
Yes that was what i was suggesting Smile
#12

[eluser]garrettheel[/eluser]
Got it, thanks Smile
#13

[eluser]kevinprince[/eluser]
Whoops sorry forgot that now() was destined for MYSQL.

Glad you were already doing validation and cleaning of your Globals!
#14

[eluser]Hartimer[/eluser]
Ok, it was tough but finally i figured it out.

I was trying precisely the same thing, using some date/time function to send to a MySQL query, which contained a DATETIME field.

The function now() (which exists after loading the date_helper btw) returns the info in UNIX format...
So the logical thing to do would be to use the function unix_to_human (which exists in the same helper).
Even with this the date was not being inserted on my database... all fields were being filled with "0000-00-00 ...".

My problem was the date format. I'm european so, to insert the data i had to use

Code:
unix_to_human(now(), TRUE, "eu");

Another thing, it worked just fine on the fly..

Code:
<?=form_open('comments/new_comment')?>
Comment: &lt;?=form_textarea("body")?&gt;<br />
&lt;?=form_hidden("date", unix_to_human(now(), TRUE, "eu"))?&gt;
&lt;?=form_submit('', "Send comment")?&gt;
&lt;?=form_close()?&gt;

Hope this helps someone




Theme © iAndrew 2016 - Forum software by © MyBB