ktm
ktm

Reputation: 6085

adding datetime in mysql with codeigniter php

how do i add datetime ( not current timestamp) but any date and time in 'datetime' field of mysql database in the format 2011-03-18 18:37:06 from php ? does jquery calendar allow time as well or what is the easy way to do so ? any help would be greatly appreceated. Thanks

Upvotes: 1

Views: 3432

Answers (2)

The Silencer
The Silencer

Reputation: 787

86400 seconds in a day, times number of days.. and add it to current time.

$nextWeek = time()+86400*7;
echo date("Y-m-d H:i:s", $nextWeek);  

Upvotes: 3

Ross
Ross

Reputation: 17987

<?php echo date("Y-m-d H:i:s"); ?>

not sure how this is CI related.

Upvotes: 1

Related Questions