can't insert unix timestamp into table's timestamp field

can definition
can synonym
can noun meaning
can bus
can band
can verb
can y

I have the table defined like this:

  name varchar(255) DEFAULT NULL,
  date timestamp NULL DEFAULT NULL
COLLATE utf8_general_ci;

Now I'm trying to insert a record:

INSERT INTO tt (name, date) VALUES('some', UNIX_TIMESTAMP(now()));

And get the following error:

Incorrect datetime value: '1428306271' for column 'date' at row 1

How can that be?

EDIT: This option also produces an error:

INSERT INTO tt (name, date) VALUES('some', UNIX_TIMESTAMP());

The correct syntax would be

INSERT INTO tt (name, date) VALUES('some', now());

date timestamp NULL DEFAULT NULL will accept the values as yyyy-mm-dd H:i:s

Can, Can may refer to: Contents. 1 Containers; 2 Music; 3 Other; 4 See also. Containers[edit]. Aluminum can · Drink can · Oil can · Steel and tin cans · Trash can  Can definition, to be able to; have the ability, power, or skill to: She can solve the problem easily, I'm sure. See more.

If you want to have current date time in field in format 2015-04-06 13:24:42,you should not require to add this field to query as it will automatically update current date time value in this format to database.

So your query will be : INSERT INTO tt (name) VALUES('some');

suppose current date time is 2015-04-06 13:24:42 so this will automatically updated to you date field ind database.

It will be as per UTC time.

The Official CAN / Spoon Records Website, Can (stylised as CAN) was a German experimental rock band formed in Cologne in 1968 by the core quartet of Holger Czukay (bass, tape editing), Irmin  Define can. can synonyms, can pronunciation, can translation, English dictionary definition of can. to be able to, have the power or skill to: I can take a bus to the

TO_TIMESTAMP is the function to convert epoch to timestamp

INSERT INTO mytable (name, time) VALUES ('Hello', TO_TIMESTAMP(123))

Can, VerbEdit. can (third-person singular simple present can, present participle -, simple past could, past participle (obsolete except in adjectival use) couth). 110 synonyms of can from the Merriam-Webster Thesaurus, plus 97 related words, definitions, and antonyms. Find another word for can. Can: to bring (as an action or operation) to an immediate end.

Can (band), can meaning: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . Learn more. Can means someone or something knows how to, is able to, is likely to or has the right to do something. An example of can is someone knowing how to play the piano. An example of can is a cat being able to paint. An example of can is a car that usually starts.

can, Can-Am offers a complete lineup of Off-Road vehicles (ATV, Side-by-Side) and 3-​wheel motorcycles (Spyder or Ryker). Choose your playground now and enjoy  In negative constructions, can't or cannot is more common than may not; the contraction mayn't is rare: You can't park in the driveway. can but and cannot but are formal and old-fashioned expressions suggesting that there is no other way to do something. can2 /kæn/ n., v., canned, can•ning.

CAN, 1.4Used to indicate that something is typically the case. 'antique clocks can seem out of place in modern homes'. More example sentences. Looking for online definition of CAN or what CAN stands for? CAN is listed in the World's largest and most authoritative dictionary database of abbreviations and acronyms The Free Dictionary

  • in which format youwant to insert data in your table
  • thanks, it works with now(), but it inserts the value as 4/6/2015 10:59:33 AM. Can I insert the value as unix timestamp, e.g. 1428306271?
  • In that case the data type should be int or varchar. But I would suggest to use Y-m-d H:i:s since later doing the query with range, finding data for a specific year etc will be such simpler than storing the integer values.
  • right, thanks, and if I get the value from client side as 1428306271, I'll be able to use FROM_UNIXTIME1428306271) on insert, and UNIX_TIMESTAMP(date) on query, correct? Would you also advice to use datetime field type or timestamp?
  • If you receive data from client side as 1428306271 then yes you can use from_unixtime() and while returning data to client can use unix_timestamp() but good practice would be store as I said earlier.