0

I need to update a column with datatype as timestamp. I run the following query:

update job_info set ProcessStartTime = UNIX_TIMESTAMP(CURDATE()) where JobID=4;

But it updates with a value : 0000-00-00 00:00:00 What could be the reason for this? Is the query incorrect?

Suhail Gupta
  • 20,940
  • 62
  • 185
  • 313

1 Answers1

0

Don't use UNIX_TIMESTAMP because MySQL UNIX_TIMESTAMP() returns a Unix timestamp in seconds or your column type is datetime

update job_info set ProcessStartTime =CURDATE() where JobID=4;

or use NOW()

update job_info set ProcessStartTime =NOW() where JobID=4;
Abhishek Sharma
  • 6,665
  • 1
  • 13
  • 20