Date with time not viewing on Form If I set a date programatically with this code:

$currentDateString=date("Y-m-d H:i:s", strtotime($current_date));
 $static_media-&gt;set('field_posted' , $currentDateString);


the data in field is there , when I do a get-&gt; i can see the date, but it does not show up in the edit view of the entity. (just shows as blank)

If I modify the date in the edit view, when I do a 'get->' the date comes out with the EDT timezone in the time , and then it does show up in the edit form.

I tried inserting it with the EDT Timezone, but I get a message that the data is too long

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too       [error]
long for column 'field_pup_posted_value' at row 1: INSERT INTO {media__field_pup_posted} (entity_id,
revision_id, bundle, delta, langcode, field_posted_value) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5); Array
(
    [:db_insert_placeholder_0] =&gt; 562729
    [:db_insert_placeholder_1] =&gt; 1045632
    [:db_insert_placeholder_2] =&gt; published_products_static
    [:db_insert_placeholder_3] =&gt; 0
    [:db_insert_placeholder_4] =&gt; en
    [:db_insert_placeholder_5] =&gt; 2017-06-08EDT17:19:31
)
I had to insert it with a T in between the date and time as follows:

$currentDateString=date("Y-m-d", strtotime($current_date))."T".date("H:i:s", strtotime($current_date));