Drupal Insert into new content type date only field from existing timestamp

CODE: 

INSERT INTO node__field_date (entity_id, bundle, revision_id, langcode, field_date_value) SELECT nid, type, vid, langcode, FROM_UNIXTIME(created, '%Y-%m-%d') FROM node_field_data 


Table comparison:

node__field_data = node__field_date

nid = entity_id

type = bundle

vid = revision_id

langcode = langcode

created = field_date_value


Sample data:

bundle:newsclips:type

entity_id:123670

revision_id:123785

langcode:en

field_date_value:2022-06-13




Comments

Popular posts from this blog

Enable Theme Debug in Drupal 9

Remove drupal 9 extensions from database

PHP redirect from http to https and www to non-www in Drupal 9