我使用cron與PHP腳本導入內容,並且有一個名爲_expiration_date的字段,我需要根據當前導入日期動態填充20天。如果我使用PHP程序手動創建記錄並查看記錄,則該程序將以下列格式在_expiration_date字段中創建數據:1449203160,其轉換爲2015年12月4日@ 4:26中的人形。用PHP插入動態DATE元數據
我認爲這是某種日期/時間戳?
正如你所看到的,我填充的字段是靜態文本。如何以正確的日期/時間格式動態填充_expiration_date字段以供系統讀取?
}
update_post_meta($post_id, 'adverts_location', $parent->name);
update_post_meta($post_id, 'adverts_person', 'John Doe');
update_post_meta($post_id, 'adverts_email', '[email protected]');
update_post_meta($post_id, '_expiration_date', '');
}
update_post_meta()的值是什麼?這個? @lucarnosky update_post_meta($ post_id,'_expiration_date','$ expirationDate'); –
是的,在expirationData你有datetime的日期時間 – Lucarnosky
這不起作用,它插入$ expirationDate作爲數據到字段@lucarnosky –