ok, so I have a pretty good database set up but I was just informed that I am inserting dates into it incorrectly. I am currently just inputing them in as a string but I was told to input them as an actual $date datatype. Anyone know how I go about doing this?
Thanks,
Jr-
inserting dates/times in DB
Moderator: General Moderators
Code: Select all
INSERT INTO MYTABLE (dttm) values (now())- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
now() is a mysql function, not php. You may run now() in a query to get the current time.
A good place to begin is http://dev.mysql.com/doc/mysql/en/date- ... rview.html
Ohh the glorious mysql manual.
A good place to begin is http://dev.mysql.com/doc/mysql/en/date- ... rview.html
Ohh the glorious mysql manual.
ok a couple more questions about that now() function.
1. do you need to insert that into the DB do I need to make the table column/cell $date formatted?
2. If i want to return that from the DB does the column/cell need to be a $date format to return a 'partial' date?
and...
3. How do i return a partial or differently formatted date then what it returns as default just printing from an array?
Thanks for the help...
Jr-
1. do you need to insert that into the DB do I need to make the table column/cell $date formatted?
2. If i want to return that from the DB does the column/cell need to be a $date format to return a 'partial' date?
and...
3. How do i return a partial or differently formatted date then what it returns as default just printing from an array?
Thanks for the help...
Jr-