Jump to content

[SOLVED] MySQL Timestamp


_giles_

Recommended Posts

You could send a mysql timestamp to the mysql db.

 

INSERT INTO table (date1) values ('NOW()')

 

If you require a custom timestamp which is not NOW-dependant, then you will have to use php's Date function and formulate the correct datetime setting according to the physical sever's datetime settings. e.g yyyy-mm-dd or yyyy-dd-mm (both of these will have a different impact on the mysql db).

In answer to the first question, we don't know how to help you debug without knowing what you're currently doing. Could you share your code with us? That way, we can point out any logical flaws we can find. Also, my first guess is that your actual format may not be correct. If you're trying to send a PHP generated date to the MySQL database and insert it into a DATE or DATETIME field, you'll need to be sure it's in the following format: YYYY-MM-DD HH:MM:SS.

You could send a mysql timestamp to the mysql db.

 

INSERT INTO table (date1) values ('NOW()')

 

If you require a custom timestamp which is not NOW-dependant, then you will have to use php's Date function and formulate the correct datetime setting according to the physical sever's datetime settings. e.g yyyy-mm-dd or yyyy-dd-mm (both of these will have a different impact on the mysql db).

There shouldn't even be such as thing as a "custom timestamp"...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.