0

How should I hide the time in this grid? I only want date to display but the time field is also coming like 13/03/2018 00:00:00

In my .xml file, this column is responsible for displaying date column:

 <block class="Magento\Backend\Block\Widget\Grid\Column" as="date">
   <arguments>
     <argument name="header" xsi:type="string" translate="true">Date</argument>
     <argument name="index" xsi:type="string">date</argument>
   </arguments>
</block>
2

Did you try following?

<block class="Magento\Backend\Block\Widget\Grid\Column" as="date">
<arguments>
    <argument name="header" xsi:type="string" translate="true">Date</argument>
    <argument name="index" xsi:type="string">date</argument>
    <argument name="options" xsi:type="array">
        <argument name="showsTime" xsi:type="boolean">false</argument>
    </argument>
</arguments>

1

The best solution to hide time for date column in UI component. For this, you need to provide the date format setting without time format as given below in your ui-component.xml file

<column name="salesperson_createddate" class="Magento\Ui\Component\Listing\Columns\Date" >
<argument name="data" xsi:type="array">
  <item name="config" xsi:type="array">
     <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
     <item name="dataType" xsi:type="string">date</item>
     <item name="label" xsi:type="string" translate="true">Created Date</item>
     <item name="dateFormat" xsi:type="string">M d, Y</item>
  </item>

0
<block class="Magento\Backend\Block\Widget\Grid\Column" as="date">
  <arguments>
    <argument name="header" xsi:type="string" translate="true">Due Date</argument>
    <argument name="index" xsi:type="string">date</argument>
    <argument name="type" xsi:type="string">datetime</argument>                            
  </arguments>
</block>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.