CodeIgniter Forums
Storing datetime in MySQL and using it - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Storing datetime in MySQL and using it (/showthread.php?tid=27832)



Storing datetime in MySQL and using it - El Forum - 02-22-2010

[eluser]Assim[/eluser]
I want to know how my CodeIgniter can store date and time in MySQL and how to use it. I've read this in the User Guide but I need information from people with experience in such matters.

-What should be my column data type be? datetime or something else.
-How can I send the current date and time in a MySQL field.
-How can I compare between two date and time fields, for example how many days, hours, etc was from one row from another.
-Tell me anything else that might be useful and worth knowing.


Storing datetime in MySQL and using it - El Forum - 02-22-2010

[eluser]umefarooq[/eluser]
you column data type can be datetime if you are using this then you have to send datetime in mysql format like 2009-02-22 12:24:05 yy-mm-dd hh:mmConfuseds format, for your more problems you can use mysql date and time functions will really helpful for you to find out difference between dates

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html


Storing datetime in MySQL and using it - El Forum - 02-22-2010

[eluser]Assim[/eluser]
How about if I wanted to make use of the date helper of CodeIgniter?