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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.