Announcement

Collapse
No announcement yet.

How to get custom time in before save hook for DateTime field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get custom time in before save hook for DateTime field

    I created an Entity with type Event

    And i have DateStart field with type as DateTime.

    I can able to get the custom selected Date , but the selected time is not correct in the before save it always shows some random minutes. not sure how to fix this.

    Please find the screenshot and let me know how i can fix it.

    this is my hook

    public function beforeSave(Entity $entity, array $options = array())
    {
    echo $entity->get('dateStart');
    exit;
    }


    in the screenshot i selected 11.00 pm in the time but in console i get 18.00 not sure how to solve this , help me on this , Thanks in advance.
Working...
X