Engine23
blogBannerImage
By Engine23

MySQL convert unix timestamp to datetime

UPDATE invoice
   SET invoice_date2 = FROM_UNIXTIME(invoice_date) WHERE invoice_date > 0;
UPDATE invoice
   SET estimated_date2 = FROM_UNIXTIME(estimated_date) WHERE estimated_date > 0;
UPDATE invoice
   SET completed_date2 = FROM_UNIXTIME(completed_date) WHERE completed_date > 0;
UPDATE lawn_contract
  SET lawn_contract_date2 = FROM_UNIXTIME(lawn_contract_date) WHERE lawn_contract_date > 0;
UPDATE tree_shrub
SET estimated_date2 = FROM_UNIXTIME(estimated_date) WHERE estimated_date > 0;
UPDATE lawn_contract
SET estimated_date2 = FROM_UNIXTIME(estimated_date) WHERE estimated_date > 0;