Drupal DateTime Field : Set Date + Time programmatically

 

$node->set('field_my_datetime', '2025-01-18T11:28:00');

$node->set('field_my_datetime', date('Y-m-d\TH:i:s', time()));

 

Notice: See the difference between T and \T above.

 

 

Neuen Kommentar schreiben

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Suche

Neueste Kommentare