• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to insert a date into the database?

#2
[eluser]NateL[/eluser]
First, You posted in the job board. Post in the right section next time ;-)

Onto your question...
You could use the date() function:

Code:
<?php
echo date('m-d-Y');  // outputs 09-19-2009
?>

so on your insert statement, it would look something like this:

Code:
$date = date('m-d-Y');
$this->db->insert('mytable', $date);


If you want more control, down to the second, you could use Epoch time. Look on the php.net manual for the time() function.


Messages In This Thread
how to insert a date into the database? - by El Forum - 09-19-2009, 10:41 AM
how to insert a date into the database? - by El Forum - 09-19-2009, 11:31 AM
how to insert a date into the database? - by El Forum - 09-19-2009, 06:02 PM
how to insert a date into the database? - by El Forum - 09-19-2009, 06:26 PM
how to insert a date into the database? - by El Forum - 09-19-2009, 07:29 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.